Function: reftex-view-crossref-when-idle

reftex-view-crossref-when-idle is a byte-compiled function defined in reftex-dcr.el.gz.

Signature

(reftex-view-crossref-when-idle)

Documentation

Display info about crossref at point in echo area or a window.

This function is designed to work with an idle timer and returns quickly if the call is useless.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-dcr.el.gz
(defun reftex-view-crossref-when-idle ()
  "Display info about crossref at point in echo area or a window.
This function is designed to work with an idle timer and returns quickly
if the call is useless."
  (and reftex-mode
       ;; Make sure message area is free if we need it.
       (or (eq reftex-auto-view-crossref 'window) (not (current-message)))
       ;; Make sure we are not already displaying this one
       (not (memq last-command '(reftex-view-crossref
                                 reftex-mouse-view-crossref)))
       ;; Quick precheck if this might be a relevant spot
       ;; `reftex-view-crossref' will do a more thorough check.
       (save-excursion
         (search-backward "\\" nil t)
         (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\|bibentry\\)"))
       ;; Also check if point is inside a mandatory argument where the
       ;; cite/ref key usually resides: (bug#38258)
       (save-excursion
         (condition-case nil
             (let ((forward-sexp-function nil))
               (up-list -1)
               (= (following-char) ?\{))
           (error nil)))
       ;; Finally, call `reftex-view-crossref':
       (condition-case nil
           (let ((current-prefix-arg nil))
             (cond
              ((eq reftex-auto-view-crossref t)
               (reftex-view-crossref -1 'echo 'quiet))
              ((eq reftex-auto-view-crossref 'window)
               (reftex-view-crossref -1 'tmp-window 'quiet))
              (t nil)))
         (error nil))))