emacs-diffs
[Top][All Lists]
Advanced

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

master ff79682 2/2: Terminate isearch when point has moved to another bu


From: Juri Linkov
Subject: master ff79682 2/2: Terminate isearch when point has moved to another buffer
Date: Thu, 8 Apr 2021 15:05:16 -0400 (EDT)

branch: master
commit ff796823e50a97761ba20796753eb6606e7d016c
Author: Gregory Heytings <gregory@heytings.org>
Commit: Juri Linkov <juri@linkov.net>

    Terminate isearch when point has moved to another buffer
    
    * lisp/isearch.el (isearch-post-command-hook): Terminate isearch
    when the command just executed has moved point to another buffer.
    https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg00309.html
---
 lisp/isearch.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 1ac1e63..5efac4c 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3054,6 +3054,10 @@ See more for options in `search-exit-option'."
            (goto-char isearch-pre-move-point))
          (isearch-search-and-update)))
      (setq isearch-pre-move-point nil))
+  ;; Terminate the search if point has moved to another buffer.
+  (unless (eq isearch--current-buffer (current-buffer))
+    (when (buffer-live-p isearch--current-buffer)
+      (with-current-buffer isearch--current-buffer (isearch-exit))))
   (force-mode-line-update))
 
 (defun isearch-quote-char (&optional count)



reply via email to

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