diff options
author | Gregory Heytings <gregory@heytings.org> | 2021-04-07 16:58:51 +0000 |
---|---|---|
committer | Juri Linkov <juri@linkov.net> | 2021-04-08 22:04:39 +0300 |
commit | ff796823e50a97761ba20796753eb6606e7d016c (patch) | |
tree | d391054a2d92d5c6066fa46c80621329102c50f9 /lisp/isearch.el | |
parent | 972bab0981fb0cc0d992b4a195ebaf33c79858c3 (diff) | |
download | emacs-ff796823e50a97761ba20796753eb6606e7d016c.tar.gz emacs-ff796823e50a97761ba20796753eb6606e7d016c.tar.bz2 emacs-ff796823e50a97761ba20796753eb6606e7d016c.zip |
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
Diffstat (limited to 'lisp/isearch.el')
-rw-r--r-- | lisp/isearch.el | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/isearch.el b/lisp/isearch.el index 1ac1e63a9b7..5efac4c78f4 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) |