Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!think!bbn!gateway!UICVM.UIC.EDU!AMANDEL%BRUSP.ANSP.BR From: AMANDEL%BRUSP.ANSP.BR@UICVM.UIC.EDU Newsgroups: comp.emacs Subject: Scrolling emacs windows under X using the mouse. Message-ID: <52442@bbn.COM> Date: 21 Feb 90 12:29:38 GMT Sender: news@bbn.COM Organization: BBN news/mail gateway Lines: 30 ____________________________________________________________________ I just got GNUemacs installed under X, and after fiddling a bit with the mouse-bound commands, decided I wanted to be able to scroll emacs windows with the help of the mouse. Being new to emacs, X an Lisp I designed this very simple command: (defun x-mouse-scroll-down (arg) "Scrolls down a page of the window the mouse is pointing at." (setq curr-window (selected-window)) (x-mouse-select arg) (scroll-down nil) (select-window curr-window)) (defkey mouse-map x-button-m-left 'x-mouse-scroll-down) There is a similar command for scrolling up. Notice that I do not want to change anything about the selected window, unless that is the window I am pointing at. This command works fine except on one condition: when scroll-down aborts, with the message "beginning of buffer". In that case, the mouse window stays selected. I have tried things like surrounding the call to scroll-down with catch or save-excursion, to no avail. Is there a simple solution to this problem? By the way, here goes a suggestion to the X hackers out there: the X-emacs interface would be much improved if, at user's request, each emacs window could have scroll bars (vertical and horizontal). Arnaldo Mandel amandel@brusp.ansp.br ____________________________________________________________________