Function: reftex-show-label-location
reftex-show-label-location is an autoloaded and byte-compiled function
defined in reftex-ref.el.gz.
Signature
(reftex-show-label-location DATA FORWARD NO-REVISIT &optional STAY ERROR)
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-ref.el.gz
;;;###autoload
(defun reftex-show-label-location (data forward no-revisit
&optional stay error)
;; View the definition site of a label in another window.
;; DATA is an entry from the docstruct list.
;; FORWARD indicates if the label is likely forward from current point.
;; NO-REVISIT means do not load a file to show this label.
;; STAY means leave the new window selected.
;; ERROR means throw an error exception when the label cannot be found.
;; If ERROR is nil, the return value of this function indicates success.
(let* ((this-window (selected-window))
(errorf (if error 'error 'message))
label file buffer re found)
(catch 'exit
(setq label (nth 0 data)
file (nth 3 data))
(unless file
(funcall errorf "Unknown label - reparse might help")
(throw 'exit nil))
;; Goto the file in another window
(setq buffer
(if no-revisit
(find-buffer-visiting file)
(reftex-get-file-buffer-force
file (not reftex-keep-temporary-buffers))))
(if buffer
;; good - the file is available
(switch-to-buffer-other-window buffer)
;; we have got a problem here. The file does not exist.
;; Let' get out of here..
(funcall errorf "Label %s not found" label)
(throw 'exit nil))
;; search for that label
(setq re (format reftex-find-label-regexp-format (regexp-quote label)))
(setq found
(if forward
(re-search-forward re nil t)
(re-search-backward re nil t)))
(unless found
(goto-char (point-min))
(unless (setq found (re-search-forward re nil t))
;; Ooops. Must be in a macro with distributed args.
(setq found
(re-search-forward
(format reftex-find-label-regexp-format2
(regexp-quote label)) nil t))))
(if (match-end 3)
(progn
(reftex-highlight 0 (match-beginning 3) (match-end 3))
(reftex-show-entry (match-beginning 3) (match-end 3))
(recenter '(4))
(unless stay (select-window this-window)))
(select-window this-window)
(funcall errorf "Label %s not found" label))
found)))