emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 afa4fcb95b: Fix "C-h k" when clicking on another frame


From: Eli Zaretskii
Subject: emacs-29 afa4fcb95b: Fix "C-h k" when clicking on another frame
Date: Sat, 3 Dec 2022 14:44:37 -0500 (EST)

branch: emacs-29
commit afa4fcb95b4c698ffe94031f344f1f47aa6b2acf
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix "C-h k" when clicking on another frame
    
    * lisp/help.el (help--analyze-key): Don't barf if the key sequence
    includes a switch-frame event.  (Bug#59785)
---
 lisp/help.el | 6 ++++--
 lisp/subr.el | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 8e1b325141..b709062cb2 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -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)))))
diff --git a/lisp/subr.el b/lisp/subr.el
index 21f43092d4..dc219a49a7 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]