mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-03 14:10:47 -08:00
* lisp/misearch.el (multi-isearch-switch-buffer): New function.
* lisp/isearch.el (isearch-search-string): * lisp/misearch.el (multi-isearch-wrap, multi-isearch-pop-state): Use it. https://lists.gnu.org/archive/html/emacs-devel/2021-05/msg00309.html
This commit is contained in:
parent
3d2c892114
commit
25c775b4e9
2 changed files with 18 additions and 9 deletions
|
|
@ -3506,9 +3506,8 @@ Optional third argument, if t, means if fail just return nil (no error).
|
|||
(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 multi-isearch-next-buffer-current-function
|
||||
(buffer-live-p multi-isearch-current-buffer))
|
||||
(switch-to-buffer multi-isearch-current-buffer))
|
||||
(when multi-isearch-next-buffer-current-function
|
||||
(multi-isearch-switch-buffer))
|
||||
(goto-char pos1)
|
||||
pos1)))
|
||||
|
||||
|
|
|
|||
|
|
@ -190,10 +190,10 @@ the initial buffer."
|
|||
(if (or (null multi-isearch-pause)
|
||||
(and multi-isearch-pause multi-isearch-current-buffer))
|
||||
(progn
|
||||
(switch-to-buffer
|
||||
(setq multi-isearch-current-buffer
|
||||
(funcall multi-isearch-next-buffer-current-function
|
||||
(current-buffer) t)))
|
||||
(setq multi-isearch-current-buffer
|
||||
(funcall multi-isearch-next-buffer-current-function
|
||||
(current-buffer) t))
|
||||
(multi-isearch-switch-buffer)
|
||||
(goto-char (if isearch-forward (point-min) (point-max))))
|
||||
(setq multi-isearch-current-buffer (current-buffer))
|
||||
(setq isearch-wrapped nil)))
|
||||
|
|
@ -208,8 +208,18 @@ search status stack."
|
|||
(defun multi-isearch-pop-state (_cmd buffer)
|
||||
"Restore the multiple buffers search state in BUFFER.
|
||||
Switch to the buffer restored from the search status stack."
|
||||
(unless (equal buffer (current-buffer))
|
||||
(switch-to-buffer (setq multi-isearch-current-buffer buffer))))
|
||||
(unless (eq buffer (current-buffer))
|
||||
(setq multi-isearch-current-buffer buffer)
|
||||
(multi-isearch-switch-buffer)))
|
||||
|
||||
;;;###autoload
|
||||
(defun multi-isearch-switch-buffer ()
|
||||
"Switch to the next buffer in multi-buffer search."
|
||||
(when (and (buffer-live-p multi-isearch-current-buffer)
|
||||
(not (eq multi-isearch-current-buffer (current-buffer))))
|
||||
(setq isearch-mode nil)
|
||||
(switch-to-buffer multi-isearch-current-buffer)
|
||||
(setq isearch-mode " M-Isearch")))
|
||||
|
||||
|
||||
;;; Global multi-buffer search invocations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue