[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 6556348: * lisp/help.el (help--read-key-sequence):
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 6556348: * lisp/help.el (help--read-key-sequence): Handle `switch-frame' events |
Date: |
Fri, 10 May 2019 08:51:48 -0400 (EDT) |
branch: master
commit 655634808ad3b324ab844c53006e648b45713364
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* lisp/help.el (help--read-key-sequence): Handle `switch-frame' events
If you do `C-h k ... mouse-1 in other frame` (at least if you have a focus
that follows the mouse), then additionally to the down-mouse-1 and mouse-1
events, a `switch-frame` event (and `select-window` event as well sometimes)
is generated. When `read-key-sequence` is called with nil for
`can-return-switch-frame`, this event is not returned but kept for later,
which causes a subsequent `sit-for` to return nil immediately.
This interfered without our "wait for double-click" which in turn prevented
us from stopping after the mouse-1 click, getting stuck waiting for
something
else instead.
(help--read-key-sequence): Pass a non-nil `can-return-switch-frame`, so the
subsequent `sit-for` returns more trustworthy information.
---
lisp/help.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lisp/help.el b/lisp/help.el
index 2b7eca9..42ff375 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -745,6 +745,7 @@ If NO-MOUSE-MOVEMENT is non-nil, ignore key sequences
starting
with `mouse-movement' events."
(let ((enable-disabled-menus-and-buttons t)
(cursor-in-echo-area t)
+ (side-event nil)
saved-yank-menu)
(unwind-protect
(let (last-modifiers key-list)
@@ -763,7 +764,8 @@ with `mouse-movement' events."
(and (memq 'click last-modifiers)
(not (sit-for (/ double-click-time 1000.0) t))))
(let* ((seq (read-key-sequence "\
-Describe the following key, mouse click, or menu item: "))
+Describe the following key, mouse click, or menu item: "
+ nil nil 'can-return-switch-frame))
(raw-seq (this-single-command-raw-keys))
(keyn (when (> (length seq) 0)
(aref seq (1- (length seq)))))
@@ -772,11 +774,18 @@ Describe the following key, mouse click, or menu item: "))
(cond
((zerop (length seq))) ;FIXME: Can this happen?
((and no-mouse-movement (eq base 'mouse-movement)) nil)
+ ((memq base '(mouse-movement switch-frame select-window))
+ ;; Mostly ignore these events since it's sometimes difficult to
+ ;; generate the event you care about without also generating
+ ;; these side-events along the way.
+ (setq side-event (cons seq raw-seq)))
((eq base 'help-echo) nil)
(t
(setq last-modifiers modifiers)
(push (cons seq raw-seq) key-list)))))
- (nreverse key-list))
+ (if side-event
+ (cons side-event (nreverse key-list))
+ (nreverse key-list)))
;; Put yank-menu back as it was, if we changed it.
(when saved-yank-menu
(setq yank-menu (copy-sequence saved-yank-menu))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 6556348: * lisp/help.el (help--read-key-sequence): Handle `switch-frame' events,
Stefan Monnier <=