Function: TeX-auto-add-type
TeX-auto-add-type is a macro defined in tex.el.
Signature
(TeX-auto-add-type NAME PREFIX &optional PLURAL)
Documentation
Add information about NAME to the parser using PREFIX.
Optional third argument PLURAL is the plural form of NAME.
By default just add an s.
This macro creates a set of variables and functions to maintain a separate type of information in the parser.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defmacro TeX-auto-add-type (name prefix &optional plural)
"Add information about NAME to the parser using PREFIX.
Optional third argument PLURAL is the plural form of NAME.
By default just add an `s'.
This macro creates a set of variables and functions to maintain a
separate type of information in the parser."
(let* ((names (or plural (concat name "s")))
(tmp (intern (concat prefix "-auto-" name)))
(add (intern (concat prefix "-add-" names)))
(local (intern (concat prefix "-" name "-list")))
(change (intern (concat prefix "-" name "-changed")))
(vardoc (concat "Information about " names
" in the current buffer.
Generated by `TeX-auto-add-type'."))
;; Avoid clash between LaTeX environments and ConTeXt
;; environments in keys of `TeX-auto-parser'.
(unique-key (concat prefix "-" name)))
`(progn
(defvar ,tmp nil ,vardoc)
(defvar ,local nil ,vardoc)
(make-variable-buffer-local ',local)
(defvar ,change nil ,vardoc)
(make-variable-buffer-local ',change)
(defun ,add (&rest ,(intern names))
,(concat "Add information about " (upcase names)
".
Information is added to the current buffer.
Generated by `TeX-auto-add-type'.")
(TeX-auto-add-information ,unique-key ,(intern names)))
(defun ,local ()
,(concat "List of " names
" active in the current buffer.
Generated by `TeX-auto-add-type'.")
(TeX-auto-list-information ,unique-key))
;; Append new type to `TeX-auto-parser' in order to make `style' type
;; always the first.
(add-to-list 'TeX-auto-parser
',(list unique-key tmp add local change) t)
(add-hook 'TeX-remove-style-hook
(lambda ()
(setq ,local nil))))))