]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/isearch.el: Preserve original value of overriding-terminal-local-map.
authorJuri Linkov <juri@linkov.net>
Tue, 23 Jul 2024 17:51:43 +0000 (20:51 +0300)
committerEshel Yaron <me@eshelyaron.com>
Wed, 24 Jul 2024 16:57:34 +0000 (18:57 +0200)
(isearch--saved-local-map): New variable (bug#72229).
(isearch-mode): Set isearch--saved-local-map to
overriding-terminal-local-map.
(isearch-done): Set overriding-terminal-local-map back to
isearch--saved-local-map.
(isearch-mouse-2): Let-bind overriding-terminal-local-map to
isearch--saved-local-map.
(isearch-done): Move comment intended to be docstring to docstring.

(cherry picked from commit 6760cedc5e0e8dc2a49d3d13e54f5f153df5a3d0)

lisp/isearch.el

index e778ce11ae467135272e71b6d7e49ecbf7353fbb..fba82234b2f81f08e4a8a3aa501e2392deaa8ef6 100644 (file)
@@ -946,6 +946,7 @@ Each element is an `isearch--state' struct where the slots are
 ;; The value of input-method-function when isearch is invoked.
 (defvar isearch-input-method-function nil)
 
+(defvar isearch--saved-local-map nil)
 (defvar isearch--saved-overriding-local-map nil)
 
 ;; Minor-mode-alist changes - kind of redundant with the
@@ -1295,6 +1296,7 @@ used to set the value of `isearch-regexp-function'."
   (setq        isearch-mode " Isearch")  ;; forward? regexp?
   (force-mode-line-update)
 
+  (setq isearch--saved-local-map overriding-terminal-local-map)
   (setq overriding-terminal-local-map isearch-mode-map)
   (run-hooks 'isearch-mode-hook)
   ;; Remember the initial map possibly modified
@@ -1413,10 +1415,12 @@ The last thing is to trigger a new round of lazy highlighting."
 
 (defun isearch-done (&optional nopush edit)
   "Exit Isearch mode.
+Called by all commands that terminate isearch-mode.
 For successful search, pass no args.
 For a failing search, NOPUSH is t.
 For going to the minibuffer to edit the search string,
-NOPUSH is t and EDIT is t."
+NOPUSH is t and EDIT is t.
+If NOPUSH is non-nil, we don't push the string on the search ring."
 
   (when isearch-resume-in-command-history
     (add-to-history 'command-history
@@ -1434,9 +1438,7 @@ NOPUSH is t and EDIT is t."
       (setq isearch--current-buffer nil)
       (setq cursor-sensor-inhibit (delq 'isearch cursor-sensor-inhibit))))
 
-  ;; Called by all commands that terminate isearch-mode.
-  ;; If NOPUSH is non-nil, we don't push the string on the search ring.
-  (setq overriding-terminal-local-map nil)
+  (setq overriding-terminal-local-map isearch--saved-local-map)
   ;; (setq pre-command-hook isearch-old-pre-command-hook) ; for lemacs
   (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
   (isearch-dehighlight)
@@ -2650,7 +2652,7 @@ Otherwise invoke whatever the calling mouse-2 command sequence
 is bound to outside of Isearch."
   (interactive "e")
   (let ((w (posn-window (event-start click)))
-        (binding (let ((overriding-terminal-local-map nil)
+        (binding (let ((overriding-terminal-local-map isearch--saved-local-map)
                        ;; Key search depends on mode (bug#47755)
                        (isearch-mode nil))
                    (key-binding (this-command-keys-vector) t))))