diff lisp/mwheel.el @ 104986:00c7c0e3f902

(mouse-wheel-mode): Make sure the new defvar doesn't actually define the variable, but only silences the byte-compiler. (mouse-wheel-change-button): Check whether mouse-wheel-mode is bound before looking it up. (mouse-wheel-scroll-amount): Also reset the bindings if this value is changed.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 12 Sep 2009 19:03:49 +0000
parents a3d3fc00075b
children 7ce04dfc904d
line wrap: on
line diff
--- a/lisp/mwheel.el	Sat Sep 12 18:48:22 2009 +0000
+++ b/lisp/mwheel.el	Sat Sep 12 19:03:49 2009 +0000
@@ -41,7 +41,7 @@
 (require 'custom)
 (require 'timer)
 
-(defvar mouse-wheel-mode nil)
+(defvar mouse-wheel-mode)
 
 ;; Setter function for mouse-button user-options.  Switch Mouse Wheel
 ;; mode off and on again so that the old button is unbound and
@@ -50,7 +50,7 @@
 (defun mouse-wheel-change-button (var button)
   (set-default var button)
   ;; Sync the bindings.
-  (when mouse-wheel-mode (mouse-wheel-mode 1)))
+  (when (bound-and-true-p mouse-wheel-mode) (mouse-wheel-mode 1)))
 
 (defvar mouse-wheel-down-button 4)
 (make-obsolete-variable 'mouse-wheel-down-button
@@ -131,7 +131,8 @@
             (choice :tag "scroll amount"
                     (const :tag "Full screen" :value nil)
                     (integer :tag "Specific # of lines")
-                    (float :tag "Fraction of window"))))))
+                    (float :tag "Fraction of window")))))
+  :set 'mouse-wheel-change-button)
 
 (defcustom mouse-wheel-progressive-speed t
   "If non-nil, the faster the user moves the wheel, the faster the scrolling.
@@ -241,6 +242,7 @@
 
 (defvar mwheel-installed-bindings nil)
 
+;; preloaded ;;;###autoload
 (define-minor-mode mouse-wheel-mode
   "Toggle mouse wheel support.
 With prefix argument ARG, turn on if positive, otherwise off.
@@ -267,7 +269,7 @@
         (push key mwheel-installed-bindings)))))
 
 ;;; Compatibility entry point
-;;;###autoload
+;; preloaded ;;;###autoload
 (defun mwheel-install (&optional uninstall)
   "Enable mouse wheel support."
   (mouse-wheel-mode (if uninstall -1 1)))