1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Handle multiple mouse events in display-buffer-override-next-command

* lisp/window.el (display-buffer-override-next-command):
Use 'mouse-event-p' to wait for more following mouse events.

* lisp/frame.el (other-frame-prefix):
* lisp/tab-bar.el (other-tab-prefix):
* lisp/windmove.el (windmove-display-in-direction):
* lisp/window.el (other-window-prefix, same-window-prefix):
Update the docstring to explain the behavior in regard
to multiple consecutive mouse events (bug#78945).
This commit is contained in:
Juri Linkov 2025-07-09 09:46:46 +03:00
parent 159ddd27ee
commit 280d6f70a3
4 changed files with 18 additions and 3 deletions

View file

@ -1262,6 +1262,9 @@ that variable should be nil."
"Display the buffer of the next command in a new frame. "Display the buffer of the next command in a new frame.
The next buffer is the buffer displayed by the next command invoked The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer). immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Creates a new frame before displaying the buffer. Creates a new frame before displaying the buffer.
When `switch-to-buffer-obey-display-actions' is non-nil, When `switch-to-buffer-obey-display-actions' is non-nil,
`switch-to-buffer' commands are also supported." `switch-to-buffer' commands are also supported."

View file

@ -3043,6 +3043,9 @@ files will be visited."
"Display the buffer of the next command in a new tab. "Display the buffer of the next command in a new tab.
The next buffer is the buffer displayed by the next command invoked The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer). immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Creates a new tab before displaying the buffer, or switches to the tab Creates a new tab before displaying the buffer, or switches to the tab
that already contains that buffer. that already contains that buffer.
When `switch-to-buffer-obey-display-actions' is non-nil, When `switch-to-buffer-obey-display-actions' is non-nil,

View file

@ -586,6 +586,9 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
"Display the next buffer in the window at direction DIR. "Display the next buffer in the window at direction DIR.
The next buffer is the buffer displayed by the next command invoked The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer). immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Create a new window if there is no window in that direction. Create a new window if there is no window in that direction.
By default, select the new window with a displayed buffer. By default, select the new window with a displayed buffer.

View file

@ -4076,6 +4076,9 @@ always effectively nil."
"Display the buffer of the next command in a new window. "Display the buffer of the next command in a new window.
The next buffer is the buffer displayed by the next command invoked The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer). immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Creates a new window before displaying the buffer. Creates a new window before displaying the buffer.
When `switch-to-buffer-obey-display-actions' is non-nil, When `switch-to-buffer-obey-display-actions' is non-nil,
`switch-to-buffer' commands are also supported." `switch-to-buffer' commands are also supported."
@ -4096,6 +4099,9 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
"Display the buffer of the next command in the same window. "Display the buffer of the next command in the same window.
The next buffer is the buffer displayed by the next command invoked The next buffer is the buffer displayed by the next command invoked
immediately after this command (ignoring reading from the minibuffer). immediately after this command (ignoring reading from the minibuffer).
In case of multiple consecutive mouse events such as <down-mouse-1>,
a mouse release event <mouse-1>, <double-mouse-1>, <triple-mouse-1>
all bound commands are handled until one of them displays a buffer.
Even when the default rule should display the buffer in a new window, Even when the default rule should display the buffer in a new window,
force its display in the already selected window. force its display in the already selected window.
When `switch-to-buffer-obey-display-actions' is non-nil, When `switch-to-buffer-obey-display-actions' is non-nil,
@ -9673,9 +9679,9 @@ to deactivate this overriding action."
;; But don't remove immediately after ;; But don't remove immediately after
;; adding the hook by the same command below. ;; adding the hook by the same command below.
(eq this-command command) (eq this-command command)
;; Don't exit on mouse down event ;; Don't exit on mouse events in anticipation
;; in anticipation of mouse release event. ;; of more related events like double click.
(memq 'down (event-modifiers last-input-event))) (mouse-event-p last-input-event))
(funcall exitfun)))) (funcall exitfun))))
;; Call post-function after the next command finishes (bug#49057). ;; Call post-function after the next command finishes (bug#49057).
(add-hook 'post-command-hook postfun) (add-hook 'post-command-hook postfun)