emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 18294854c71 4/6: mwheel.el: Remove `mouse-wheel-*-alternate-event


From: Stefan Monnier
Subject: master 18294854c71 4/6: mwheel.el: Remove `mouse-wheel-*-alternate-event` vars
Date: Sat, 20 Jan 2024 15:18:25 -0500 (EST)

branch: master
commit 18294854c717a82966090e99130bcb99fc354a5b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    mwheel.el: Remove `mouse-wheel-*-alternate-event` vars
    
    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.
---
 lisp/completion-preview.el |  4 ---
 lisp/edmacro.el            | 11 +------
 lisp/mwheel.el             | 76 +++++++++++++---------------------------------
 3 files changed, 22 insertions(+), 69 deletions(-)

diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index 48b6a4fd822..f552db7aa8e 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -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)
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 9ade554f559..9d185d79142 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -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)
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index f50376c72b5..438ca5f84d5 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -60,44 +60,28 @@
   (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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]