]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix "C-h k" when clicking on another frame
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Dec 2022 19:43:36 +0000 (21:43 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 Dec 2022 19:43:36 +0000 (21:43 +0200)
* lisp/help.el (help--analyze-key): Don't barf if the key sequence
includes a switch-frame event.  (Bug#59785)

lisp/help.el
lisp/subr.el

index 8e1b325141e64e4b537357d7e3e166b39224ab85..b709062cb27af7013883e6937f27ba88b9b85a31 100644 (file)
@@ -861,11 +861,13 @@ in the selected window."
         (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers)
                            (memq 'drag modifiers))
                         " at that spot" ""))
+         (click-pos (event-end event))
          ;; Use `posn-set-point' to handle the case when a menu item
          ;; is selected from the context menu that should describe KEY
          ;; at the position of mouse click that opened the context menu.
-         ;; When no mouse was involved, don't use `posn-set-point'.
-         (defn (if buffer
+         ;; When no mouse was involved, or the event doesn't provide a
+         ;; valid position, don't use `posn-set-point'.
+         (defn (if (or buffer (not (consp click-pos)))
                    (key-binding key t)
                  (save-excursion (posn-set-point (event-end event))
                                  (key-binding key t)))))
index 21f43092d4282e2d4dca96f38acb2a0d66973634..dc219a49a743335506792628aceceae1774b156e 100644 (file)
@@ -1729,7 +1729,7 @@ and `event-end' functions."
      ((eq area 'horizontal-scroll-bar)
       (cons (scroll-bar-scale pair (window-width window)) 0))
      (t
-      (if use-window
+      (if (and (windowp frame-or-window) use-window)
           (cons (/ (car pair) (window-font-width window))
                 (/ (cdr pair) (window-font-height window)))
         ;; FIXME: This should take line-spacing properties on