* 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.
This commit is contained in:
parent
e8709e7900
commit
655634808a
1 changed files with 11 additions and 2 deletions
13
lisp/help.el
13
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))
|
||||
|
|
Loading…
Add table
Reference in a new issue