Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Make mouse scroll wheels work in xemacs UNIX
To make the scroll wheel work in XEmacs, edit your .emacs file to include the text in the second part of this hint.

[robg adds: I haven't tested this one, so if you do, please post a comment as to whether or not it worked for you...]

;;=======================================
;;        scroll on  mouse wheel
;;=======================================

;; scroll on wheel of mouses
(define-key global-map 'button4
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-down 5)
      (select-window curwin)
)))
(define-key global-map [(shift button4)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-down 1)
      (select-window curwin)
)))
(define-key global-map [(control button4)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-down)
      (select-window curwin)
)))

(define-key global-map 'button5
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-up 5)
      (select-window curwin)
)))
(define-key global-map [(shift button5)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-up 1)
      (select-window curwin)
)))
(define-key global-map [(control button5)]
  '(lambda (&rest args)
    (interactive) 
    (let ((curwin (selected-window)))
      (select-window (car (mouse-pixel-position)))
      (scroll-up)
      (select-window curwin)
)))
This effectively defines button 4 and 5 as up and down keys, enabling you to scroll with your scroll wheel.
    •    
  • Currently 2.83 / 5
  You rated: 1 / 5 (6 votes cast)
 
[15,037 views]  

Make mouse scroll wheels work in xemacs | 6 comments | Create New Account
Click here to return to the 'Make mouse scroll wheels work in xemacs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Make mouse scroll wheels work in xemacs
Authored by: jaacob on Mar 05, '03 09:46:08AM

This works just fine for me. Scrolling with the mousewheel feels a bit heavy handed (scrolls larger blocks at a time), but right now its beyond me to find out why. Nice addition to my .xemacs file.



[ Reply to This | # ]
Make mouse scroll wheels work in xemacs
Authored by: Koenraad on Mar 05, '03 11:06:52AM

Here is an alternative, which is simpler and scrolls one line at a time:

(global-set-key 'button5 'scroll-up-one)
(global-set-key 'button4 'scroll-down-one)
(global-set-key '(control button5) 'scroll-up)
(global-set-key '(control button4) 'scroll-down)

It's not anything I came up with myself, this has been around.

Koenraad



[ Reply to This | # ]
Make mouse scroll wheels work in xemacs
Authored by: GlennT on Mar 05, '03 01:18:31PM
I get the following error, for both of these methods:
Error in init file: Wrong type argument: arrayp, button5
Any idea what's up? I can't imaging that emacs' syntax has changed, and this is relatively simple stuff.

[ Reply to This | # ]
Make mouse scroll wheels work in xemacs
Authored by: jpski on Mar 05, '03 01:36:25PM

It looks like the posted solution is an attempt to scroll the window over which the mouse cursor is currently positioned. I just tried it however & it doesn't do anything (for me - 21.4) that the simple version already does.

(global-set-key [(button4)] 'scroll-down)
(global-set-key [(button5)] 'scroll-up)



[ Reply to This | # ]
Make mouse scroll wheels work in xemacs
Authored by: rzigweid on Mar 06, '03 08:44:21AM

I haven't completely tested this as my mac is not going to be available to me until tomorrow night, but this really has to be overkill. The functionality is already included with Xemacs.

The part that I haven't tested is putting it into a startup file. Once that's done it may or may not work in both emacs and xemacs (haven't used emacs in a long time). Generally what I do is just:

M-x mwheel-install

This is done after Xemacs is started and it works just fine. On my linux box, I put (mwheel-install) into my .xemacs/init.el and it's on by default. I will certainly test this on my mac when I get home.

NOTES: I'm using Xemacs from fink and with Apples X11

If this accomplishes the same thing, why not just use this one liner instead.



[ Reply to This | # ]
Make mouse scroll wheels work in xemacs
Authored by: gdelfino on Mar 09, '03 10:50:13PM
This hint came from http://koala.ilog.fr/colas/mouse-wheel-scroll/#xemacs. In this page you will learn to use the mousewheel in other UNIX apps as well.

[ Reply to This | # ]