Mercurial > emacs
comparison lisp/mwheel.el @ 26410:55a234a9fe88
Fix copyright notice. Don't require 'cl at run time.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Thu, 11 Nov 1999 14:01:46 +0000 |
parents | 7eb699cb9ef2 |
children | 553975760fe9 |
comparison
equal
deleted
inserted
replaced
26409:d88786cedd00 | 26410:55a234a9fe88 |
---|---|
2 | 2 |
3 ;; Copyright (C) 1998, Free Software Foundation, Inc. | 3 ;; Copyright (C) 1998, Free Software Foundation, Inc. |
4 ;; Maintainer: William M. Perry <wmperry@gnu.org> | 4 ;; Maintainer: William M. Perry <wmperry@gnu.org> |
5 ;; Keywords: mouse | 5 ;; Keywords: mouse |
6 | 6 |
7 ;; This file is part of Emacs. | 7 ;; This file is part of GNU Emacs. |
8 | 8 |
9 ;; XEmacs is free software; you can redistribute it and/or modify it | 9 ;; GNU Emacs is free software; you can redistribute it and/or modify |
10 ;; under the terms of the GNU General Public License as published by | 10 ;; it under the terms of the GNU General Public License as published by |
11 ;; the Free Software Foundation; either version 2, or (at your option) | 11 ;; the Free Software Foundation; either version 2, or (at your option) |
12 ;; any later version. | 12 ;; any later version. |
13 | 13 |
14 ;; XEmacs is distributed in the hope that it will be useful, but | 14 ;; GNU Emacs is distributed in the hope that it will be useful, |
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | 15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 ;; General Public License for more details. | 17 ;; GNU General Public License for more details. |
18 | 18 |
19 ;; You should have received a copy of the GNU General Public License | 19 ;; You should have received a copy of the GNU General Public License |
20 ;; along with XEmacs; see the file COPYING. If not, write to the | 20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
22 ;; Boston, MA 02111-1307, USA. | 22 ;; Boston, MA 02111-1307, USA. |
23 | |
24 ;;; Synched up with: Not synched. | |
25 | 23 |
26 ;;; Commentary: | 24 ;;; Commentary: |
27 | 25 |
28 ;; This code will enable the use of the infamous 'wheel' on the new | 26 ;; This code will enable the use of the infamous 'wheel' on the new |
29 ;; crop of mice. Under XFree86 and the XSuSE X Servers, the wheel | 27 ;; crop of mice. Under XFree86 and the XSuSE X Servers, the wheel |
35 ;; portably), so for now I just live with it. | 33 ;; portably), so for now I just live with it. |
36 | 34 |
37 ;; To enable this code, simply put this at the top of your .emacs | 35 ;; To enable this code, simply put this at the top of your .emacs |
38 ;; file: | 36 ;; file: |
39 ;; | 37 ;; |
40 ;; (autoload 'mwheel-install "mwheel" "Enable mouse wheel support.") | |
41 ;; (mwheel-install) | 38 ;; (mwheel-install) |
42 | 39 |
43 ;;; Code: | 40 ;;; Code: |
44 | 41 |
45 (require 'custom) | 42 (require 'custom) |
46 (require 'cl) | |
47 | 43 |
48 (defcustom mwheel-scroll-amount '(5 . 1) | 44 (defcustom mwheel-scroll-amount '(5 . 1) |
49 "Amount to scroll windows by when spinning the mouse wheel. | 45 "Amount to scroll windows by when spinning the mouse wheel. |
50 This is actually a cons cell, where the first item is the amount to scroll | 46 This is actually a cons cell, where the first item is the amount to scroll |
51 on a normal wheel event, and the second is the amount to scroll when the | 47 on a normal wheel event, and the second is the amount to scroll when the |
90 (select-window (mwheel-event-window event))))) | 86 (select-window (mwheel-event-window event))))) |
91 (amt (if (memq 'shift (event-modifiers event)) | 87 (amt (if (memq 'shift (event-modifiers event)) |
92 (cdr mwheel-scroll-amount) | 88 (cdr mwheel-scroll-amount) |
93 (car mwheel-scroll-amount)))) | 89 (car mwheel-scroll-amount)))) |
94 (unwind-protect | 90 (unwind-protect |
95 (case (mwheel-event-button event) | 91 (let ((button (mwheel-event-button event))) |
96 (4 (scroll-down amt)) | 92 (cond ((= button 4) (scroll-down amt)) |
97 (5 (scroll-up amt)) | 93 ((= button 5) (scroll-up amt)) |
98 (otherwise (error "Bad binding in mwheel-scroll"))) | 94 (t (error "Bad binding in mwheel-scroll")))) |
99 (if curwin (select-window curwin))))) | 95 (if curwin (select-window curwin))))) |
100 | 96 |
101 ;;;###autoload | 97 ;;;###autoload |
102 (defun mwheel-install () | 98 (defun mwheel-install () |
103 "Enable mouse wheel support." | 99 "Enable mouse wheel support." |