Function: TeX-arg-document

TeX-arg-document is a byte-compiled function defined in latex.el.

Signature

(TeX-arg-document OPTIONAL &optional IGNORE)

Documentation

Insert arguments to documentclass.

OPTIONAL and IGNORE are ignored.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun TeX-arg-document (_optional &optional _ignore)
  "Insert arguments to documentclass.
OPTIONAL and IGNORE are ignored."
  (let* ((TeX-file-extensions '("cls"))
         (crm-separator ",")
         style var options defopt optprmpt)
    (unless LaTeX-global-class-files
      (setq LaTeX-global-class-files
            (if (if (eq TeX-arg-input-file-search 'ask)
                    (not (y-or-n-p "Find class yourself? "))
                  TeX-arg-input-file-search)
                (prog2
                    (message "Searching for LaTeX classes...")
                    (TeX-search-files-by-type 'texinputs 'global t t)
                  (message "Searching for LaTeX classes...done"))
              LaTeX-style-list)))
    (setq style (completing-read
                 (format-prompt "Document class" LaTeX-default-style)
                 LaTeX-global-class-files nil nil nil nil LaTeX-default-style))
    ;; Clean up hook before use.
    (setq TeX-after-document-hook nil)
    (TeX-load-style style)
    (setq var (intern (format "LaTeX-%s-class-options" style)))
    (setq defopt (if (stringp LaTeX-default-options)
                     LaTeX-default-options
                   (mapconcat #'identity LaTeX-default-options ",")))
    (setq optprmpt
          (if (and defopt (not (string-equal defopt "")))
              (format-prompt "Options" defopt)
            "Options: "))
    (if (or (and (boundp var)
                 (listp (symbol-value var)))
            (fboundp var))
        (if (functionp var)
            (setq options (funcall var))
          (when (symbol-value var)
            (setq options
                  (mapconcat #'identity
                             (TeX-completing-read-multiple
                              optprmpt (mapcar #'list (symbol-value var))
                              nil nil nil nil defopt)
                             ","))))
      (setq options (TeX-read-string optprmpt nil nil defopt)))
    (unless (zerop (length options))
      (insert LaTeX-optop options LaTeX-optcl)
      (let ((opts (LaTeX-listify-package-options options)))
        (TeX-add-to-alist 'LaTeX-provided-class-options
                          (list (cons style opts)))))
    (insert TeX-grop style TeX-grcl))

  (TeX-update-style t)
  (run-hooks 'TeX-after-document-hook))