Function: reftex-isearch-minor-mode

reftex-isearch-minor-mode is an autoloaded, interactive and byte-compiled function defined in reftex-global.el.gz.

Signature

(reftex-isearch-minor-mode &optional ARG)

Documentation

When on, isearch searches the whole document, not only the current file.

This minor mode allows isearch to search through all the files of the current TeX document.

With no argument, this command toggles reftex-isearch-minor-mode(var)/reftex-isearch-minor-mode(fun). With a prefix argument ARG, turn reftex-isearch-minor-mode(var)/reftex-isearch-minor-mode(fun) on if ARG is positive, otherwise turn it off.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-global.el.gz
;; NB this is a global autoload - see reftex.el.
;;;###autoload
(defun reftex-isearch-minor-mode (&optional arg)
  "When on, isearch searches the whole document, not only the current file.
This minor mode allows isearch to search through all the files of
the current TeX document.

With no argument, this command toggles
`reftex-isearch-minor-mode'.  With a prefix argument ARG, turn
`reftex-isearch-minor-mode' on if ARG is positive, otherwise turn it off."
  (interactive "P")
  (let ((old-reftex-isearch-minor-mode reftex-isearch-minor-mode))
    (setq reftex-isearch-minor-mode
	  (not (or (and (null arg) reftex-isearch-minor-mode)
		   (<= (prefix-numeric-value arg) 0))))
    (unless (eq reftex-isearch-minor-mode old-reftex-isearch-minor-mode)
      (if reftex-isearch-minor-mode
	  (progn
	    (dolist (crt-buf (buffer-list))
	      (with-current-buffer crt-buf
		(when reftex-mode
		  (if (boundp 'multi-isearch-next-buffer-function)
		      (set (make-local-variable
			    'multi-isearch-next-buffer-function)
			   #'reftex-isearch-switch-to-next-file)
		    (set (make-local-variable 'isearch-wrap-function)
			 #'reftex-isearch-wrap-function)
		    (set (make-local-variable 'isearch-search-fun-function)
			 (lambda () #'reftex-isearch-isearch-search))
		    (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))))
	    (add-hook 'reftex-mode-hook #'reftex-isearch-minor-mode))
	(dolist (crt-buf (buffer-list))
	  (with-current-buffer crt-buf
	    (when reftex-mode
	      (if (boundp 'multi-isearch-next-buffer-function)
		  (kill-local-variable 'multi-isearch-next-buffer-function)
		(kill-local-variable 'isearch-wrap-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))))
	(remove-hook 'reftex-mode-hook #'reftex-isearch-minor-mode)))
    ;; Force mode line redisplay.
    (set-buffer-modified-p (buffer-modified-p))))