From 2a000d2eee25ca0ccbb5f0c638c7c9bd0a653808 Mon Sep 17 00:00:00 2001 From: Gregory Heytings Date: Wed, 7 Apr 2021 10:16:24 +0000 Subject: [PATCH] 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. --- lisp/isearch.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/isearch.el b/lisp/isearch.el index a828c569aa..a93e7a9576 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3040,6 +3040,9 @@ 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)) + (with-current-buffer isearch--current-buffer (isearch-exit))) (force-mode-line-update)) (defun isearch-quote-char (&optional count) -- 2.30.2