]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle multiple mouse events in display-buffer-override-next-command
authorJuri Linkov <juri@linkov.net>
Wed, 9 Jul 2025 06:46:46 +0000 (09:46 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 07:52:23 +0000 (09:52 +0200)
* 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).

(cherry picked from commit 280d6f70a356dc24a7026c00cbcbd116c2f7c7ed)

lisp/frame.el
lisp/tab-bar.el
lisp/windmove.el
lisp/window.el

index 5f8fd53290ffc4ebd49fdf856d7d1358ad89ba48..03cff754bfea987374a7c6ed56f615dc86af7749 100644 (file)
@@ -1262,6 +1262,9 @@ that variable should be nil."
   "Display the buffer of the next command in a new frame.
 The next buffer is the buffer displayed by the next command invoked
 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.
 When `switch-to-buffer-obey-display-actions' is non-nil,
 `switch-to-buffer' commands are also supported."
index 9fc255b56847f04eb6ed74ad20978e7bca9d63f5..76c7909cd0a6ef08549f512f8f3d6a43d0ab907e 100644 (file)
@@ -3027,6 +3027,9 @@ files will be visited."
   "Display the buffer of the next command in a new tab.
 The next buffer is the buffer displayed by the next command invoked
 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
 that already contains that buffer.
 When `switch-to-buffer-obey-display-actions' is non-nil,
index a46eaaadbb6b6fd570994558163efac9bdd6969a..6e670e6c0aabbd39b8d42c6e341b03675b3e858a 100644 (file)
@@ -441,6 +441,9 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
   "Display the next buffer in the window at direction DIR.
 The next buffer is the buffer displayed by the next command invoked
 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.
 
 By default, select the new window with a displayed buffer.
index f8f9e3113ada7aee64cf079fe67a36c461378a0f..61626f5a3e7a7230317818709dc5a91a60dda53a 100644 (file)
@@ -4017,6 +4017,9 @@ always effectively nil."
   "Display the buffer of the next command in a new window.
 The next buffer is the buffer displayed by the next command invoked
 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.
 When `switch-to-buffer-obey-display-actions' is non-nil,
 `switch-to-buffer' commands are also supported."
@@ -4037,6 +4040,9 @@ When `switch-to-buffer-obey-display-actions' is non-nil,
   "Display the buffer of the next command in the same window.
 The next buffer is the buffer displayed by the next command invoked
 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,
 force its display in the already selected window.
 When `switch-to-buffer-obey-display-actions' is non-nil,
@@ -9631,9 +9637,9 @@ to deactivate this overriding action."
                      ;; But don't remove immediately after
                      ;; adding the hook by the same command below.
                      (eq this-command command)
-                     ;; Don't exit on mouse down event
-                     ;; in anticipation of mouse release event.
-                     (memq 'down (event-modifiers last-input-event)))
+                     ;; Don't exit on mouse events in anticipation
+                     ;; of more related events like double click.
+                     (mouse-event-p last-input-event))
               (funcall exitfun))))
     ;; Call post-function after the next command finishes (bug#49057).
     (add-hook 'post-command-hook postfun)