]> git.eshelyaron.com Git - emacs.git/commitdiff
mwheel.el: Remove `mouse-wheel-*-alternate-event` vars
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 12 Jan 2024 23:52:37 +0000 (18:52 -0500)
committerEshel Yaron <me@eshelyaron.com>
Sun, 21 Jan 2024 07:30:52 +0000 (08:30 +0100)
Now that `wheel-DIR` events are hardcoded, we never need more than
one variable (which we actually never needed anyway, we could have
let `mouse-wheel-*-event` vars hold lists of events instead), so
remove the `mouse-wheel-*-alternate-event` vars by merging their
default value into that of the corresponding `mouse-wheel-*-event`.

* lisp/mwheel.el (mouse-wheel-down-event, mouse-wheel-up-event)
(mouse-wheel-left-event, mouse-wheel-right-event): Don't bother holding
`wheel-DIR` events since these are already handled anyway.
Hold the event that would have been held in
`mouse-wheel-DIR-alternate-event` instead.
(mouse-wheel-down-alternate-event, mouse-wheel-up-alternate-event)
(mouse-wheel-left-alternate-event, mouse-wheel-right-alternate-event):
Delete vars.
(mwheel--is-dir-p, mouse-wheel--setup-bindings):
* lisp/edmacro.el (edmacro-fix-menu-commands):
* lisp/completion-preview.el (completion-preview--mouse-map):
Don't use `mouse-wheel-up/down-alternate-event` any more.
* lisp/progmodes/flymake.el (flymake--mode-line-counter-map):
Do nothing, because it already ignored those vars.

(cherry picked from commit 18294854c717a82966090e99130bcb99fc354a5b)

lisp/completion-preview.el
lisp/edmacro.el
lisp/mwheel.el

index 48b6a4fd8224b3aff9db4145aa426db2606284f6..f552db7aa8e2799f778168cfa10156d2e5a9ee87 100644 (file)
@@ -139,11 +139,7 @@ If this option is nil, these commands do not display any message."
   "<wheel-down>"   #'completion-preview-next-candidate
   (key-description (vector mouse-wheel-up-event))
   #'completion-preview-prev-candidate
-  (key-description (vector mouse-wheel-up-alternate-event))
-  #'completion-preview-prev-candidate
   (key-description (vector mouse-wheel-down-event))
-  #'completion-preview-next-candidate
-  (key-description (vector mouse-wheel-down-alternate-event))
   #'completion-preview-next-candidate)
 
 (defvar-local completion-preview--overlay nil)
index 9ade554f5593a072b79be681f0ef681ac40eccd0..9d185d79142f26cb9735c42bca39cdd613811ee3 100644 (file)
@@ -729,10 +729,6 @@ This function assumes that the events can be stored in a string."
         (defvar mouse-wheel-up-event)
         (defvar mouse-wheel-right-event)
         (defvar mouse-wheel-left-event)
-        (defvar mouse-wheel-down-alternate-event)
-        (defvar mouse-wheel-up-alternate-event)
-        (defvar mouse-wheel-right-alternate-event)
-        (defvar mouse-wheel-left-alternate-event)
        ;; Make a list of the elements.
        (setq macro (append macro nil))
        (dolist (ev macro)
@@ -749,12 +745,7 @@ This function assumes that the events can be stored in a string."
                ((or (mouse-event-p ev) (mouse-movement-p ev)
                     (memq (event-basic-type ev)
                           `( ,mouse-wheel-down-event ,mouse-wheel-up-event
-                             ,mouse-wheel-right-event
-                             ,mouse-wheel-left-event
-                             ,mouse-wheel-down-alternate-event
-                             ,mouse-wheel-up-alternate-event
-                             ,mouse-wheel-right-alternate-event
-                             ,mouse-wheel-left-alternate-event
+                             ,mouse-wheel-right-event ,mouse-wheel-left-event
                              wheel-down wheel-up wheel-left wheel-right)))
                 nil)
                (noerror nil)
index f50376c72b576900496df24df8417de6ef39f7c1..438ca5f84d5b3d2edeef3602e560e33a55ba1449 100644 (file)
   (if (or (featurep 'w32-win) (featurep 'ns-win)
           (featurep 'haiku-win) (featurep 'pgtk-win)
           (featurep 'android-win))
-      'wheel-up
+      (if (featurep 'xinput2)
+          nil
+        (unless (featurep 'x)
+         'mouse-4))
     'mouse-4)
-  "Event used for scrolling down."
+  "Event used for scrolling down, beside `wheel-down', if any."
   :group 'mouse
   :type 'symbol
   :set 'mouse-wheel-change-button)
 
-(defcustom mouse-wheel-down-alternate-event
-  (if (featurep 'xinput2)
-      'wheel-up
-    (unless (featurep 'x)
-      'mouse-4))
-  "Alternative wheel down event to consider."
-  :group 'mouse
-  :type 'symbol
-  :version "29.1"
-  :set 'mouse-wheel-change-button)
-
 (defcustom mouse-wheel-up-event
   (if (or (featurep 'w32-win) (featurep 'ns-win)
           (featurep 'haiku-win) (featurep 'pgtk-win)
           (featurep 'android-win))
-      'wheel-down
+      (if (featurep 'xinput2)
+          nil
+        (unless (featurep 'x)
+          'mouse-5))
     'mouse-5)
-  "Event used for scrolling up."
-  :group 'mouse
-  :type 'symbol
-  :set 'mouse-wheel-change-button)
-
-(defcustom mouse-wheel-up-alternate-event
-  (if (featurep 'xinput2)
-      'wheel-down
-    (unless (featurep 'x)
-      'mouse-5))
-  "Alternative wheel up event to consider."
+  "Event used for scrolling up, beside `wheel-up', if any."
   :group 'mouse
   :type 'symbol
-  :version "29.1"
   :set 'mouse-wheel-change-button)
 
 (defcustom mouse-wheel-click-event 'mouse-2
@@ -252,31 +236,23 @@ Also see `mouse-wheel-tilt-scroll'."
   (if (or (featurep 'w32-win) (featurep 'ns-win)
           (featurep 'haiku-win) (featurep 'pgtk-win)
           (featurep 'android-win))
-      'wheel-left
+      (if (featurep 'xinput2)
+          nil
+        (unless (featurep 'x)
+          'mouse-6))
     'mouse-6)
-  "Event used for scrolling left.")
-
-(defvar mouse-wheel-left-alternate-event
-  (if (featurep 'xinput2)
-      'wheel-left
-    (unless (featurep 'x)
-      'mouse-6))
-  "Alternative wheel left event to consider.")
+  "Event used for scrolling left, beside `wheel-left', if any.")
 
 (defvar mouse-wheel-right-event
   (if (or (featurep 'w32-win) (featurep 'ns-win)
           (featurep 'haiku-win) (featurep 'pgtk-win)
           (featurep 'android-win))
-      'wheel-right
+      (if (featurep 'xinput2)
+          nil
+        (unless (featurep 'x)
+          'mouse-7))
     'mouse-7)
-  "Event used for scrolling right.")
-
-(defvar mouse-wheel-right-alternate-event
-  (if (featurep 'xinput2)
-      'wheel-right
-    (unless (featurep 'x)
-      'mouse-7))
-  "Alternative wheel right event to consider.")
+  "Event used for scrolling right, beside `wheel-right', if any.")
 
 (defun mouse-wheel--get-scroll-window (event)
   "Return window for mouse wheel event EVENT.
@@ -308,13 +284,11 @@ active window."
 (defmacro mwheel--is-dir-p (dir button)
   (declare (debug (sexp form)))
   (let ((custom-var (intern (format "mouse-wheel-%s-event" dir)))
-        (custom-var-alt (intern (format "mouse-wheel-%s-alternate-event" dir)))
         (event (intern (format "wheel-%s" dir))))
     (macroexp-let2 nil butsym button
       `(or (eq ,butsym ',event)
-           (eq ,butsym ,custom-var)
            ;; We presume here `button' is never nil.
-           (eq ,butsym ,custom-var-alt)))))
+           (eq ,butsym ,custom-var)))))
 
 (defun mwheel-scroll (event &optional arg)
   "Scroll up or down according to the EVENT.
@@ -504,16 +478,12 @@ an event used for scrolling, such as `mouse-wheel-down-event'."
      ;; Bindings for changing font size.
      ((and (consp binding) (eq (cdr binding) 'text-scale))
       (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
-                           mouse-wheel-down-alternate-event
-                           mouse-wheel-up-alternate-event
                            'wheel-down 'wheel-up))
         (when event
           (mouse-wheel--add-binding `[,(append (car binding) (list event))]
                                     'mouse-wheel-text-scale))))
      ((and (consp binding) (eq (cdr binding) 'global-text-scale))
       (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
-                           mouse-wheel-down-alternate-event
-                           mouse-wheel-up-alternate-event
                            'wheel-down 'wheel-up))
         (when event
           (mouse-wheel--add-binding `[,(append (car binding) (list event))]
@@ -522,10 +492,6 @@ an event used for scrolling, such as `mouse-wheel-down-event'."
      (t
       (dolist (event (list mouse-wheel-down-event mouse-wheel-up-event
                            mouse-wheel-left-event mouse-wheel-right-event
-                           mouse-wheel-down-alternate-event
-                           mouse-wheel-up-alternate-event
-                           mouse-wheel-left-alternate-event
-                           mouse-wheel-right-alternate-event
                            'wheel-down 'wheel-up 'wheel-left 'wheel-right))
         (when event
           (dolist (key (mouse-wheel--create-scroll-keys binding event))