Function: reftex-view-cr-cite

reftex-view-cr-cite is a byte-compiled function defined in reftex-dcr.el.gz.

Signature

(reftex-view-cr-cite ARG KEY HOW)

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-dcr.el.gz
(defun reftex-view-cr-cite (arg key how)
  ;; View crossreference of a ref cite.  HOW can have the values
  ;; nil:         Show in another window.
  ;; echo:        Show one-line info in echo area.
  ;; tmp-window:  Show in small window and arrange for window to disappear.

  ;; Ensure access to scanning info
  (reftex-access-scan-info (or arg current-prefix-arg))

  (if (eq how 'tmp-window)
      ;; Remember the window configuration
      (put 'reftex-auto-view-crossref 'last-window-conf
           (current-window-configuration)))

  (let (files size item (pos (point)) (win (selected-window)) pop-win
              (bibtype (reftex-bib-or-thebib)))
    ;; Find the citation mode and the file list
    (cond
;     ((assq 'bib (symbol-value reftex-docstruct-symbol))
     ((eq bibtype 'bib)
      (setq item nil
            files (reftex-get-bibfile-list)))
;     ((assq 'thebib (symbol-value reftex-docstruct-symbol))
     ((eq bibtype 'thebib)
      (setq item t
            files (reftex-uniquify
                   (mapcar #'cdr
                           (reftex-all-assq
                            'thebib (symbol-value reftex-docstruct-symbol))))))
     (reftex-default-bibliography
      (setq item nil
            files (reftex-default-bibliography)))
     (how)  ;; don't throw for special display
     (t (error "Cannot display crossref")))

    (if (eq how 'echo)
        ;; Display in Echo area
        (reftex-echo-cite key files item)
      ;; Display in a window
      (if (not (eq how 'tmp-window))
          ;; Normal display
          (reftex-pop-to-bibtex-entry key files nil t item)
        ;; A temporary window
        (condition-case nil
            (reftex-pop-to-bibtex-entry key files nil t item)
          (error (goto-char pos)
                 (message "cite: no such citation key %s" key)
                 (error "")))
        ;; Resize the window
        (setq size (max 1 (count-lines (point)
                                       (reftex-end-of-bib-entry item))))
        (let ((window-min-height 2))
          (shrink-window (1- (- (window-height) size)))
          (recenter 0))
        ;; Arrange restoration
        (add-hook 'pre-command-hook #'reftex-restore-window-conf))

        ;; Normal display in other window
      (add-hook 'pre-command-hook #'reftex-highlight-shall-die)
      (setq pop-win (selected-window))
      (select-window win)
      (goto-char pos)
      (when (equal arg 2)
        (select-window pop-win)))))