changeset 85569:6c0aa34f6c37

(isearch-search-string): After finding the next occurrence switch to buffer isearch-buffers-current-buffer when isearch-buffers-next-buffer-function is non-nil and isearch-buffers-current-buffer is live.
author Juri Linkov <juri@jurta.org>
date Mon, 22 Oct 2007 23:44:29 +0000
parents 76aa2c1e4934
children cd304d007007
files lisp/isearch.el
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/isearch.el	Mon Oct 22 23:43:38 2007 +0000
+++ b/lisp/isearch.el	Mon Oct 22 23:44:29 2007 +0000
@@ -2035,8 +2035,13 @@
 			   (if isearch-forward (< pos2 pos1) (> pos2 pos1))))
 	      (setq pos1 pos2)
 	      (set-match-data match-data)))))
-    (if pos1
-	(goto-char pos1))
+    (when pos1
+      ;; When using multiple buffers isearch, switch to the new buffer here,
+      ;; because `save-excursion' above doesn't allow doing it inside funcall.
+      (if (and isearch-buffers-next-buffer-function
+	       (buffer-live-p isearch-buffers-current-buffer))
+	  (switch-to-buffer isearch-buffers-current-buffer))
+      (goto-char pos1))
     pos1))
 
 (defun isearch-search ()