[Top][All Lists]

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

emacs-28 8230a47: * lisp/help.el (help--analyze-key): Prefer posn-set-po

From: Juri Linkov
Subject: emacs-28 8230a47: * lisp/help.el (help--analyze-key): Prefer posn-set-point over mouse-set-point
Date: Wed, 1 Dec 2021 12:36:15 -0500 (EST)

branch: emacs-28
commit 8230a47ecc8c11f518ee20a9055c0c27339a6730
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/help.el (help--analyze-key): Prefer posn-set-point over 
    * lisp/help.el (help--analyze-key): Use posn-set-point instead of
    mouse-set-point that runs the hook mouse-leave-buffer-hook via
    mouse-minibuffer-check.  Using posn-set-point also unnecessitates
    extra conditions added in bug#51421.
    * lisp/isearch.el (isearch-describe-key, isearch-describe-mode):
    Add precautions to not call isearch-update when the executed
    command exited isearch-mode (bug#51173).
 lisp/help.el    | 14 +++++---------
 lisp/isearch.el |  4 ++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/lisp/help.el b/lisp/help.el
index 21c8255..47faf44 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -697,18 +697,14 @@ in the selected window."
         (mouse-msg (if (or (memq 'click modifiers) (memq 'down modifiers)
                            (memq 'drag modifiers))
                         " at that spot" ""))
-         ;; Use `mouse-set-point' to handle the case when a menu item
+         ;; 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 `mouse-set-point'.
-         (defn (if (or buffer
-                       ;; Clicks on the menu bar produce "event" that
-                       ;; is just '(menu-bar)', for which
-                       ;; `mouse-set-point' is not useful.
-                       (and (not (windowp (posn-window (event-start event))))
-                            (not (framep (posn-window (event-start event))))))
+         ;; When no mouse was involved, don't use `posn-set-point'.
+         (defn (if buffer
                    (key-binding key t)
-                 (save-excursion (mouse-set-point event) (key-binding key 
+                 (save-excursion (posn-set-point (event-end event))
+                                 (key-binding key t)))))
     ;; Handle the case where we faked an entry in "Select and Paste" menu.
     (when (and (eq defn nil)
               (stringp (aref key (1- (length key))))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index d9a48cf..c382d0a 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -521,14 +521,14 @@ This is like `describe-bindings', but displays only 
Isearch keys."
   (let ((display-buffer-overriding-action isearch--display-help-action))
     (call-interactively 'describe-key))
-  (isearch-update))
+  (when isearch-mode (isearch-update)))
 (defun isearch-describe-mode ()
   "Display documentation of Isearch mode."
   (let ((display-buffer-overriding-action isearch--display-help-action))
     (describe-function 'isearch-forward))
-  (isearch-update))
+  (when isearch-mode (isearch-update)))
 (defalias 'isearch-mode-help 'isearch-describe-mode)

reply via email to

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