[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/mwheel-no-alts b0f04ce4d34 5/7: mwheel.el: Unconditionally use t
From: |
Stefan Monnier |
Subject: |
scratch/mwheel-no-alts b0f04ce4d34 5/7: mwheel.el: Unconditionally use the `wheel-up/down/...` events |
Date: |
Fri, 12 Jan 2024 19:07:20 -0500 (EST) |
branch: scratch/mwheel-no-alts
commit b0f04ce4d3495de8593e3b64ddd218cd3bad221c
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
mwheel.el: Unconditionally use the `wheel-up/down/...` events
The `mouse-wheel-DIR-event` vars were introduced because under X11
we get different `mouse-N` events depending on the users' mouse and
those same events can be used for other things for other rodents, so we
can't unconditionally treat those events as mouse-wheel events.
But this does not apply to the `wheel-up/down/...` events.
So hard code them.
* lisp/mwheel.el (mwheel--is-dir-p): Always consider the `wheel-DIR` events.
(mouse-wheel--setup-bindings): Always bind the `wheel-DIR` events.
* lisp/completion-preview.el (completion-preview--mouse-map):
Unconditionally bind the `wheel-DIR` events.
* lisp/edmacro.el (edmacro-fix-menu-commands): Hard code the
`wheel-DIR` events as mouse events regardless of `mouse-wheel-*-event`s.
* lisp/progmodes/flymake.el (flymake--mode-line-counter-map):
Do nothing, because it's already been done in commit e5be6c7ae309.
---
lisp/completion-preview.el | 2 ++
lisp/edmacro.el | 15 ++++++++-------
lisp/mwheel.el | 15 ++++++++++-----
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el
index 3bb5ef24e9d..48b6a4fd822 100644
--- a/lisp/completion-preview.el
+++ b/lisp/completion-preview.el
@@ -135,6 +135,8 @@ If this option is nil, these commands do not display any
message."
"<down-mouse-1>" #'completion-preview-insert
"C-<down-mouse-1>" #'completion-at-point
"<down-mouse-2>" #'completion-at-point
+ "<wheel-up>" #'completion-preview-prev-candidate
+ "<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))
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 5bd0c1892e5..9ade554f559 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -748,13 +748,14 @@ This function assumes that the events can be stored in a
string."
;; info is recorded in macros to make this possible.
((or (mouse-event-p ev) (mouse-movement-p ev)
(memq (event-basic-type ev)
- (list 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-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
+ wheel-down wheel-up wheel-left wheel-right)))
nil)
(noerror nil)
(t
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 84679f5c33f..f50376c72b5 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -308,9 +308,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))))
+ (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 ,custom-var)
+ `(or (eq ,butsym ',event)
+ (eq ,butsym ,custom-var)
;; We presume here `button' is never nil.
(eq ,butsym ,custom-var-alt)))))
@@ -503,14 +505,16 @@ an event used for scrolling, such as
`mouse-wheel-down-event'."
((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))
+ 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))
+ mouse-wheel-up-alternate-event
+ 'wheel-down 'wheel-up))
(when event
(mouse-wheel--add-binding `[,(append (car binding) (list event))]
'mouse-wheel-global-text-scale))))
@@ -521,7 +525,8 @@ an event used for scrolling, such as
`mouse-wheel-down-event'."
mouse-wheel-down-alternate-event
mouse-wheel-up-alternate-event
mouse-wheel-left-alternate-event
- mouse-wheel-right-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))
(mouse-wheel--add-binding key 'mwheel-scroll))))))))
- branch scratch/mwheel-no-alts created (now f355557bb9e), Stefan Monnier, 2024/01/12
- scratch/mwheel-no-alts ee2a8fd4cff 1/7: (mouse-wheel-*-event): Minor cleanups, Stefan Monnier, 2024/01/12
- scratch/mwheel-no-alts b9959e94d26 4/7: * lisp/completion-preview.el: Fix use in non-GUI session, Stefan Monnier, 2024/01/12
- scratch/mwheel-no-alts 8cb8b973653 6/7: mwheel.el: Remove `mouse-wheel-*-alternate-event` vars, Stefan Monnier, 2024/01/12
- scratch/mwheel-no-alts b0f04ce4d34 5/7: mwheel.el: Unconditionally use the `wheel-up/down/...` events,
Stefan Monnier <=
- scratch/mwheel-no-alts a764b503e12 2/7: (mwheel--is-dir-p): New macro to reduce code duplication, Stefan Monnier, 2024/01/12
- scratch/mwheel-no-alts f355557bb9e 7/7: mwheel.el: Code clean to reduce duplication, Stefan Monnier, 2024/01/12
- scratch/mwheel-no-alts 3bd8e963f7c 3/7: * lisp/keymap.el (define-keymap): Demote "duplicate def" to a warning, Stefan Monnier, 2024/01/12