[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master db8890b3c96 3/6: mwheel.el: Unconditionally use the `wheel-up/dow
From: |
Stefan Monnier |
Subject: |
master db8890b3c96 3/6: mwheel.el: Unconditionally use the `wheel-up/down/...` events |
Date: |
Sat, 20 Jan 2024 15:18:24 -0500 (EST) |
branch: master
commit db8890b3c96289ca95e4ea3ea53f0eda1a948af6
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.
* doc/lispref/commands.texi (Misc Events): Document the need to use
`wheel-up/down/left/right` unconditionally.
---
doc/lispref/commands.texi | 29 +++++++++++++++--------------
etc/NEWS | 7 +++++++
lisp/completion-preview.el | 2 ++
lisp/edmacro.el | 15 ++++++++-------
lisp/mwheel.el | 15 ++++++++++-----
5 files changed, 42 insertions(+), 26 deletions(-)
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 10f47d736d2..5f840ac21ec 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -2562,23 +2562,24 @@ non-@code{nil}.
@vindex mouse-wheel-up-event
@vindex mouse-wheel-down-event
The @code{wheel-up} and @code{wheel-down} events are generated only on
-some kinds of systems. On other systems, @code{mouse-4} and
-@code{mouse-5} are used instead. For portable code, use the variables
-@code{mouse-wheel-up-event}, @code{mouse-wheel-up-alternate-event},
-@code{mouse-wheel-down-event} and
-@code{mouse-wheel-down-alternate-event} defined in @file{mwheel.el} to
-determine what event types to expect from the mouse wheel.
+some kinds of systems. On other systems, other events like @code{mouse-4} and
+@code{mouse-5} are used instead. Portable code should handle both
+@code{wheel-up} and @code{wheel-down} events as well as the events
+specified in the variables @code{mouse-wheel-up-event} and
+@code{mouse-wheel-down-event}, defined in @file{mwheel.el}.
@vindex mouse-wheel-left-event
@vindex mouse-wheel-right-event
-Similarly, some mice can generate @code{mouse-wheel-left-event} and
-@code{mouse-wheel-right-event} and can be used to scroll if
-@code{mouse-wheel-tilt-scroll} is non-@code{nil}. However, some mice
-also generate other events at the same time as they're generating
-these scroll events which may get in the way. The way to fix this is
-generally to unbind these events (for instance, @code{mouse-6} or
-@code{mouse-7}, but this is very hardware and operating system
-dependent).
+The same holds for the horizontal wheel movements which are usually
+represented by @code{wheel-left} and @code{wheel-right} events, but
+for which portable code should also obey the variables
+@code{mouse-wheel-left-event} and @code{mouse-wheel-right-event},
+defined in @file{mwheel.el}.
+However, some mice also generate other events at the same time as
+they're generating these scroll events which may get in the way.
+The way to fix this is generally to unbind these events (for instance,
+@code{mouse-6} or @code{mouse-7}, but this is very hardware and
+operating system dependent).
@cindex @code{pinch} event
@item (pinch @var{position} @var{dx} @var{dy} @var{scale} @var{angle})
diff --git a/etc/NEWS b/etc/NEWS
index f4d008ee2d6..fefdfb2afb3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -406,6 +406,13 @@ respectively, in addition to the existing translations
'C-x 8 / e' and
* Changes in Specialized Modes and Packages in Emacs 30.1
++++
+** Mwheel
+The 'wheel-up/down/left/right' events are now bound unconditionally,
+and the 'mouse-wheel-up/down/left/right-event' variables are thus
+used only to specify the 'mouse-4/5/6/7' events generated by
+legacy setup, such as 'xterm-mouse-mode' or X11 without XInput2.
+
+++
** New command 'lldb'.
Run the LLDB debugger, analogous to the 'gud-gdb' command.
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))))))))
- master updated (3add626f140 -> 54d3de64e19), Stefan Monnier, 2024/01/20
- master 54d3de64e19 6/6: Merge branch 'mwheel-no-alts', Stefan Monnier, 2024/01/20
- master 18294854c71 4/6: mwheel.el: Remove `mouse-wheel-*-alternate-event` vars, Stefan Monnier, 2024/01/20
- master db8890b3c96 3/6: mwheel.el: Unconditionally use the `wheel-up/down/...` events,
Stefan Monnier <=
- master eb779ae6467 1/6: * lisp/keymap.el (define-keymap): Demote "duplicate def" to a warning, Stefan Monnier, 2024/01/20
- master 998667f9026 5/6: mwheel.el: Code clean to reduce duplication, Stefan Monnier, 2024/01/20
- master 82f71e106af 2/6: * lisp/completion-preview.el: Fix use in non-GUI session, Stefan Monnier, 2024/01/20