Function: reftex-arg-label

reftex-arg-label is an autoloaded and byte-compiled function defined in reftex-auc.el.gz.

Signature

(reftex-arg-label OPTIONAL &optional PROMPT DEFINITION)

Documentation

Use reftex-label, reftex-reference or AUCTeX's code to insert label arg.

What is being used depends upon reftex-plug-into-AUCTeX(var)/reftex-plug-into-AUCTeX(fun).

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-auc.el.gz
;;;###autoload
(defun reftex-arg-label (optional &optional prompt definition)
  "Use `reftex-label', `reftex-reference' or AUCTeX's code to insert label arg.
What is being used depends upon `reftex-plug-into-AUCTeX'."
  (let (label)
    (cond
     ((and definition (reftex-plug-flag 1))
      ;; Create a new label, with a temporary brace for `reftex-what-macro'
      (unwind-protect
          (progn (insert "{") (setq label (or (reftex-label nil t) "")))
        (delete-char -1)))
     ((and (not definition) (reftex-plug-flag 2))
      ;; Reference a label with RefTeX
      (setq label (reftex-reference nil t)))
     (t
      ;; AUCTeX's default mechanism
      (setq label (completing-read (TeX-argument-prompt optional prompt "Key")
                                   (LaTeX-label-list)))))
    (if (and definition (not (string-equal "" label)))
        (LaTeX-add-labels label))
    (TeX-argument-insert label optional)))