Function: TeX-run-style-hooks

TeX-run-style-hooks is a byte-compiled function defined in tex.el.

Signature

(TeX-run-style-hooks &rest STYLES)

Documentation

Run the TeX style hooks STYLES.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex.el
(defun TeX-run-style-hooks (&rest styles)
  "Run the TeX style hooks STYLES."
  (mapcar (lambda (style)
            ;; Avoid recursion.
            (unless (TeX-member style TeX-active-styles #'string-equal)
              (setq TeX-active-styles
                    (cons style TeX-active-styles))
              (TeX-load-style style)
              (let ((default-directory default-directory))
                ;; Complex path.
                (when (string-match "\\`\\(.+[/\\]\\)\\([^/\\]*\\)\\'" style)
                  ;; Set `default-directory' to directory of master
                  ;; file since style files not stored in the fixed
                  ;; style directories are usually located there.
                  (setq default-directory (save-match-data
                                            (TeX-master-directory))
                        style (substring style
                                         (match-beginning 2) (match-end 2))))
                (condition-case nil
                    (mapcar (lambda (hook)
                              (cond
                               ((functionp hook)
                                (funcall hook))
                               ((and (vectorp hook)
                                     (eq (aref hook 0) 'TeX-style-hook))
                                (and (TeX-shdex-in-p TeX-style-hook-dialect (aref hook 2))
                                     (funcall (aref hook 1))))
                               (t (error "Invalid style hook %S" hook))))
                            ;; Reverse the list of style hooks in order to run
                            ;; styles in the order global, private, local
                            ;; (assuming TeX-style-path has that ordering,
                            ;; too).
                            (reverse (cdr-safe (assoc-string style TeX-style-hook-list))))
                  ;; This happens in case some style added a new parser, and
                  ;; now the style isn't used anymore (user deleted
                  ;; \usepackage{style}).  Then we're left over with, e.g.,
                  ;; (LaTeX-add-siunitx-units "\\parsec"), but the function is
                  ;; defined in a style siunitx.el that's not loaded anymore.
                  (void-function nil)))))
          styles))