Commit fa862320 authored by Juri Linkov's avatar Juri Linkov
Browse files

(reftex-isearch-switch-to-next-file):

Use `find-file-noselect' instead of `find-file' (for Emacs 22 and 23).
(reftex-isearch-minor-mode): If `multi-isearch-next-buffer-function'
is bound set it to `reftex-isearch-switch-to-next-file'.  Otherwise,
set 4 obsolete variables for backward-compatibility with Emacs 22.
parent 9b7322d8
...@@ -343,6 +343,14 @@ Also checks if buffers visiting the files are in read-only mode." ...@@ -343,6 +343,14 @@ Also checks if buffers visiting the files are in read-only mode."
(buffer-name buf))) (buffer-name buf)))
(error "Abort")))))) (error "Abort"))))))
;;; Multi-file RefTeX Isearch
;;; `reftex-isearch-wrap-function', `reftex-isearch-push-state-function',
;;; `reftex-isearch-pop-state-function', `reftex-isearch-isearch-search'
;;; functions remain here only for backward-compatibility with Emacs 22
;;; and are obsolete since Emacs 23 that supports a single function
;;; variable `multi-isearch-next-buffer-function'.
(defun reftex-isearch-wrap-function () (defun reftex-isearch-wrap-function ()
(if (not isearch-word) (if (not isearch-word)
(switch-to-buffer (switch-to-buffer
...@@ -416,7 +424,7 @@ Also checks if buffers visiting the files are in read-only mode." ...@@ -416,7 +424,7 @@ Also checks if buffers visiting the files are in read-only mode."
(setq flist (cdr flist))) (setq flist (cdr flist)))
(setq flist (cdr flist))) (setq flist (cdr flist)))
(when flist (when flist
(find-file (car flist)))))) (find-file-noselect (car flist))))))
;;;###autoload ;;;###autoload
(defun reftex-isearch-minor-mode (&optional arg) (defun reftex-isearch-minor-mode (&optional arg)
...@@ -438,23 +446,28 @@ With no argument, this command toggles ...@@ -438,23 +446,28 @@ With no argument, this command toggles
(dolist (crt-buf (buffer-list)) (dolist (crt-buf (buffer-list))
(with-current-buffer crt-buf (with-current-buffer crt-buf
(when reftex-mode (when reftex-mode
(set (make-local-variable 'isearch-wrap-function) (if (boundp 'multi-isearch-next-buffer-function)
'reftex-isearch-wrap-function) (set (make-local-variable 'multi-isearch-next-buffer-function)
(set (make-local-variable 'isearch-search-fun-function) 'reftex-isearch-switch-to-next-file)
(lambda () 'reftex-isearch-isearch-search)) (set (make-local-variable 'isearch-wrap-function)
(set (make-local-variable 'isearch-push-state-function) 'reftex-isearch-wrap-function)
'reftex-isearch-push-state-function) (set (make-local-variable 'isearch-search-fun-function)
(set (make-local-variable 'isearch-next-buffer-function) (lambda () 'reftex-isearch-isearch-search))
'reftex-isearch-switch-to-next-file) (set (make-local-variable 'isearch-push-state-function)
'reftex-isearch-push-state-function)
(set (make-local-variable 'isearch-next-buffer-function)
'reftex-isearch-switch-to-next-file))
(setq reftex-isearch-minor-mode t)))) (setq reftex-isearch-minor-mode t))))
(add-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)) (add-hook 'reftex-mode-hook 'reftex-isearch-minor-mode))
(dolist (crt-buf (buffer-list)) (dolist (crt-buf (buffer-list))
(with-current-buffer crt-buf (with-current-buffer crt-buf
(when reftex-mode (when reftex-mode
(kill-local-variable 'isearch-wrap-function) (if (boundp 'multi-isearch-next-buffer-function)
(kill-local-variable 'isearch-search-fun-function) (kill-local-variable 'multi-isearch-next-buffer-function)
(kill-local-variable 'isearch-push-state-function) (kill-local-variable 'isearch-wrap-function)
(kill-local-variable 'isearch-next-buffer-function) (kill-local-variable 'isearch-search-fun-function)
(kill-local-variable 'isearch-push-state-function)
(kill-local-variable 'isearch-next-buffer-function))
(setq reftex-isearch-minor-mode nil)))) (setq reftex-isearch-minor-mode nil))))
(remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode))) (remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)))
;; Force modeline redisplay. ;; Force modeline redisplay.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment