2007-01-12

GNU Emacs Mouse Wheel

Scott Hurring's .emacs has some lines of interest:

;; Turn ON mouse wheel support
(mouse-wheel-mode)

This mouse-wheel-mode doesn't seem to be available in GNU Emacs 20.4.1 (sparc-sun-solaris2.5.1) - instead a couple functions are defined in the .emacs:

;; Mousewheel
(defun sd-mousewheel-scroll-up (event)
  "Scroll window under mouse up by five lines."
  (interactive "e")
  (let ((current-window (selected-window)))
    (unwind-protect
        (progn 
          (select-window (posn-window (event-start event)))
          (scroll-up 5))
      (select-window current-window))))

(defun sd-mousewheel-scroll-down (event)
  "Scroll window under mouse down by five lines."
  (interactive "e")
  (let ((current-window (selected-window)))
    (unwind-protect
        (progn 
          (select-window (posn-window (event-start event)))
          (scroll-down 5))
      (select-window current-window))))

(global-set-key (kbd "") 'sd-mousewheel-scroll-up)
(global-set-key (kbd "") 'sd-mousewheel-scroll-down)

Seems like quite a lot of code, but this probably is what's obscured by the mwheel and mouse-wheel-mode modules.

According to the Fedora Emacs docs, the following should work with "the older version 20 of Emacs":

;; Enable wheelmouse support by default
(require 'mwheel)

However, this doesn't seem to work with the Solaris version - probably because mwheel appears is not installed.

Other items of interest here include:

;; show line numbers at bottom
(setq line-number-mode t)
(setq column-number-mode t)
(line-number-mode t)
(column-number-mode t)

;; no crap in *scratch* on startup
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message t)