Function: reftex-view-regexp-match
reftex-view-regexp-match is a byte-compiled function defined in
reftex-dcr.el.gz.
Signature
(reftex-view-regexp-match RE &optional HIGHLIGHT-GROUP NEW REF-BUFFER)
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-dcr.el.gz
(defun reftex-view-regexp-match (re &optional highlight-group new ref-buffer)
;; Search for RE in current document or in the document of REF-BUFFER.
;; Continue the search, if the same re was searched last.
;; Highlight the group HIGHLIGHT-GROUP of the match.
;; When NEW is non-nil, start a new search regardless.
;; Match point is displayed in another window.
;; Upon success, returns the window which displays the match.
;;; Decide if new search or continued search
(let* ((oldprop (get 'reftex-view-regexp-match :props))
(newprop (list (current-buffer) re))
(cont (and (not new) (equal oldprop newprop)))
(cnt (if cont (get 'reftex-view-regexp-match :cnt) 0))
(current-window (selected-window))
(window-conf (current-window-configuration))
match pop-window)
(switch-to-buffer-other-window (or ref-buffer (current-buffer)))
;; Search
(condition-case nil
(if cont
(setq match (reftex-global-search-continue))
(reftex-access-scan-info)
(setq match (reftex-global-search re (reftex-all-document-files))))
(error nil))
;; Evaluate the match.
(if match
(progn
(put 'reftex-view-regexp-match :props newprop)
(put 'reftex-view-regexp-match :cnt (incf cnt))
(reftex-highlight 0 (match-beginning highlight-group)
(match-end highlight-group))
(add-hook 'pre-command-hook #'reftex-highlight-shall-die)
(setq pop-window (selected-window)))
(put 'reftex-view-regexp-match :props nil)
(or cont (set-window-configuration window-conf)))
(select-window current-window)
(if match
(progn
(message "Match Nr. %s" cnt)
pop-window)
(if cont
(error "No further matches (total number of matches: %d)" cnt)
(error "No matches")))))