aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/loadup.el5
-rw-r--r--lisp/mwheel.el47
-rw-r--r--lisp/startup.el2
4 files changed, 35 insertions, 27 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ac9426aebe7..9bd63cf99aa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
12009-09-12 Stefan Monnier <monnier@iro.umontreal.ca> 12009-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * mwheel.el (mwheel-installed-bindings): New var.
4 (mouse-wheel-mode): Use it, so as to make sure we really remove all
5 the bindings we set last time. Use custom-initialize-delay.
6 * loadup.el: Load mwheel after term/*-win.el.
7 * startup.el (command-line): Don't reevaluate mouse-wheel-down-event
8 and mouse-wheel-up-event now that their first evaluation is done
9 sufficiently late to be correct.
10
3 * startup.el (tutorial-directory): Make it a defcustom. 11 * startup.el (tutorial-directory): Make it a defcustom.
4 Use custom-initialize-delay rather than eval-at-startup to set it. 12 Use custom-initialize-delay rather than eval-at-startup to set it.
5 * image.el (image-load-path): Make it a defcustom. 13 * image.el (image-load-path): Make it a defcustom.
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 8fd2eb90736..da7613bee25 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -180,7 +180,6 @@
180 (load "image") 180 (load "image")
181 (load "international/fontset") 181 (load "international/fontset")
182 (load "dnd") 182 (load "dnd")
183 (load "mwheel")
184 (load "tool-bar"))) 183 (load "tool-bar")))
185(if (featurep 'x) 184(if (featurep 'x)
186 (progn 185 (progn
@@ -213,6 +212,10 @@
213 (progn 212 (progn
214 (load "emacs-lisp/easymenu") ;; for platform-related menu adjustments 213 (load "emacs-lisp/easymenu") ;; for platform-related menu adjustments
215 (load "term/ns-win"))) 214 (load "term/ns-win")))
215(if (fboundp 'x-create-frame)
216 ;; Do it after loading term/foo-win.el since the value of the
217 ;; mouse-wheel-*-event vars depends on those files being loaded or not.
218 (load "mwheel"))
216(if (fboundp 'atan) ; preload some constants and 219(if (fboundp 'atan) ; preload some constants and
217 (progn ; floating pt. functions if we have float support. 220 (progn ; floating pt. functions if we have float support.
218 (load "emacs-lisp/float-sup"))) 221 (load "emacs-lisp/float-sup")))
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 37980279a28..d457679d4f2 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -46,11 +46,9 @@
46;; new button is bound to mwheel-scroll. 46;; new button is bound to mwheel-scroll.
47 47
48(defun mouse-wheel-change-button (var button) 48(defun mouse-wheel-change-button (var button)
49 (let ((active mouse-wheel-mode)) 49 (set-default var button)
50 ;; Deactivate before changing the setting. 50 ;; Sync the bindings.
51 (when active (mouse-wheel-mode -1)) 51 (when mouse-wheel-mode (mouse-wheel-mode 1)))
52 (set-default var button)
53 (when active (mouse-wheel-mode 1))))
54 52
55(defvar mouse-wheel-down-button 4) 53(defvar mouse-wheel-down-button 4)
56(make-obsolete-variable 'mouse-wheel-down-button 54(make-obsolete-variable 'mouse-wheel-down-button
@@ -239,32 +237,33 @@ This should only be bound to mouse buttons 4 and 5."
239 (run-with-timer mouse-wheel-inhibit-click-time nil 237 (run-with-timer mouse-wheel-inhibit-click-time nil
240 'mwheel-inhibit-click-timeout)))) 238 'mwheel-inhibit-click-timeout))))
241 239
240(defvar mwheel-installed-bindings nil)
241
242;;;###autoload 242;;;###autoload
243(define-minor-mode mouse-wheel-mode 243(define-minor-mode mouse-wheel-mode
244 "Toggle mouse wheel support. 244 "Toggle mouse wheel support.
245With prefix argument ARG, turn on if positive, otherwise off. 245With prefix argument ARG, turn on if positive, otherwise off.
246Return non-nil if the new state is enabled." 246Return non-nil if the new state is enabled."
247 :init-value t
248 ;; We'd like to use custom-initialize-set here so the setup is done
249 ;; before dumping, but at the point where the defcustom is evaluated,
250 ;; the corresponding function isn't defined yet, so
251 ;; custom-initialize-set signals an error.
252 :initialize 'custom-initialize-delay
247 :global t 253 :global t
248 :group 'mouse 254 :group 'mouse
249 (let* ((dn mouse-wheel-down-event) 255 ;; Remove previous bindings, if any.
250 (up mouse-wheel-up-event) 256 (while mwheel-installed-bindings
251 (keys 257 (let ((key (pop mwheel-installed-bindings)))
252 (nconc (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,up)]) 258 (when (eq (lookup-key (current-global-map) key) 'mwheel-scroll)
253 mouse-wheel-scroll-amount) 259 (global-unset-key key))))
254 (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,dn)]) 260 ;; Setup bindings as needed.
255 mouse-wheel-scroll-amount)))) 261 (when mouse-wheel-mode
256 ;; This condition-case is here because Emacs 19 will throw an error 262 (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event))
257 ;; if you try to define a key that it does not know about. I for one 263 (dolist (key (mapcar (lambda (amt) `[(,@(if (consp amt) (car amt)) ,event)])
258 ;; prefer to just unconditionally do a mwheel-install in my .emacs, so 264 mouse-wheel-scroll-amount))
259 ;; that if the wheeled-mouse is there, it just works, and this way it 265 (global-set-key key 'mwheel-scroll)
260 ;; doesn't yell at me if I'm on my laptop or another machine, etc. 266 (push key mwheel-installed-bindings)))))
261 (condition-case ()
262 (dolist (key keys)
263 (cond (mouse-wheel-mode
264 (global-set-key key 'mwheel-scroll))
265 ((eq (lookup-key (current-global-map) key) 'mwheel-scroll)
266 (global-unset-key key))))
267 (error nil))))
268 267
269;;; Compatibility entry point 268;;; Compatibility entry point
270;;;###autoload 269;;;###autoload
diff --git a/lisp/startup.el b/lisp/startup.el
index 5d5f23e4453..d5133290ba8 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -920,8 +920,6 @@ opening the first frame (e.g. open a connection to an X server).")
920 (custom-reevaluate-setting 'blink-cursor-mode) 920 (custom-reevaluate-setting 'blink-cursor-mode)
921 (custom-reevaluate-setting 'tooltip-mode) 921 (custom-reevaluate-setting 'tooltip-mode)
922 (custom-reevaluate-setting 'global-font-lock-mode) 922 (custom-reevaluate-setting 'global-font-lock-mode)
923 (custom-reevaluate-setting 'mouse-wheel-down-event)
924 (custom-reevaluate-setting 'mouse-wheel-up-event)
925 (custom-reevaluate-setting 'file-name-shadow-mode) 923 (custom-reevaluate-setting 'file-name-shadow-mode)
926 (custom-reevaluate-setting 'send-mail-function) 924 (custom-reevaluate-setting 'send-mail-function)
927 (custom-reevaluate-setting 'focus-follows-mouse) 925 (custom-reevaluate-setting 'focus-follows-mouse)