Function: TeX-auto-store
TeX-auto-store is a byte-compiled function defined in tex.el.
Signature
(TeX-auto-store FILE)
Documentation
Extract information for AUCTeX from current buffer and store it in FILE.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-auto-store (file)
"Extract information for AUCTeX from current buffer and store it in FILE."
(TeX-auto-parse)
(if (member nil (mapcar #'TeX-auto-entry-clear-p TeX-auto-parser))
(let ((style (TeX-strip-extension nil TeX-all-extensions t))
(class-opts (if (boundp 'LaTeX-provided-class-options)
LaTeX-provided-class-options))
(pkg-opts (if (boundp 'LaTeX-provided-package-options)
LaTeX-provided-package-options))
(tex-cmd-opts TeX-command-extra-options)
(verb-envs (when (boundp 'LaTeX-verbatim-environments-local)
LaTeX-verbatim-environments-local))
(verb-macros-delims (when (boundp 'LaTeX-verbatim-macros-with-delims-local)
LaTeX-verbatim-macros-with-delims-local))
(verb-macros-braces (when (boundp 'LaTeX-verbatim-macros-with-braces-local)
LaTeX-verbatim-macros-with-braces-local))
(dialect TeX-style-hook-dialect)
(bibtex-p (eq major-mode 'bibtex-mode)))
(TeX-unload-style style)
(with-current-buffer (generate-new-buffer file)
(erase-buffer)
(insert ";; -*- lexical-binding: t; -*-\n\n")
(insert "(TeX-add-style-hook\n \""
style "\"\n (lambda ()")
(unless (string= tex-cmd-opts "")
(insert "\n (setq TeX-command-extra-options\n"
" " (prin1-to-string tex-cmd-opts) ")"))
(when class-opts
(insert "\n (TeX-add-to-alist 'LaTeX-provided-class-options\n"
" '" (prin1-to-string class-opts) ")"))
(when pkg-opts
(insert "\n (TeX-add-to-alist 'LaTeX-provided-package-options\n"
" '" (prin1-to-string pkg-opts) ")"))
(dolist (env verb-envs)
(insert
(format "\n (add-to-list 'LaTeX-verbatim-environments-local \"%s\")"
env)))
(dolist (env verb-macros-braces)
(insert
(format "\n (add-to-list 'LaTeX-verbatim-macros-with-braces-local \"%s\")"
env)))
(dolist (env verb-macros-delims)
(insert
(format "\n (add-to-list 'LaTeX-verbatim-macros-with-delims-local \"%s\")"
env)))
(mapc (lambda (el) (TeX-auto-insert el style))
TeX-auto-parser)
(insert ")")
(if dialect (insert (concat
"\n "
(prin1-to-string
(if bibtex-p
;; Add :latex since functions such
;; as `LaTeX-add-bibitems' are
;; only meaningful in LaTeX
;; document buffer.
;; FIXME: BibTeX is available to
;; plain TeX through eplain
;; (<URL:https://tug.org/eplain/doc/eplain.html#Citations>).
;; It would be nice if AUCTeX
;; supports such usage.
`'(or ,dialect :latex)
dialect)))))
(insert ")\n\n")
(write-region (point-min) (point-max) file nil 'silent)
(kill-buffer (current-buffer))))
(if (file-exists-p (concat file "c"))
(delete-file (concat file "c")))
(if (file-exists-p file)
(delete-file file))))