]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/help.el (help--analyze-key): Prefer posn-set-point over mouse-set-point
authorJuri Linkov <juri@linkov.net>
Wed, 1 Dec 2021 17:36:00 +0000 (19:36 +0200)
committerJuri Linkov <juri@linkov.net>
Wed, 1 Dec 2021 17:36:00 +0000 (19:36 +0200)
* 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
lisp/isearch.el

index 21c8255c6900a680ce9a22a57095935b125232fe..47faf44b37fb80244efc356424d290de8f75629d 100644 (file)
@@ -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 t)))))
+                 (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))))
index d9a48cfcf2d64de3279e4d3f3ff5e720095b1213..c382d0ad2a0d5d84258f42a26d696806c3778681 100644 (file)
@@ -521,14 +521,14 @@ This is like `describe-bindings', but displays only Isearch keys."
   (interactive)
   (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."
   (interactive)
   (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)