Function: LaTeX-indent-commands-regexp-make

LaTeX-indent-commands-regexp-make is a byte-compiled function defined in latex.el.

Signature

(LaTeX-indent-commands-regexp-make)

Documentation

Calculate final regexp for adjusting indentation.

This function takes the elements provided in LaTeX-indent-begin-list, LaTeX-indent-begin-exceptions-list, LaTeX-indent-mid-list and LaTeX-indent-end-list and generates the regexp's which are stored in LaTeX-indent-begin-regexp-local, LaTeX-indent-begin-regexp-exceptions-local, LaTeX-indent-mid-regexp-local and LaTeX-indent-end-regexp-local accordingly. Some standard macros are added to the regexp's. This function is called in LaTeX-mode-cleanup to set the regexp's.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-indent-commands-regexp-make ()
  "Calculate final regexp for adjusting indentation.
This function takes the elements provided in
`LaTeX-indent-begin-list', `LaTeX-indent-begin-exceptions-list',
`LaTeX-indent-mid-list' and `LaTeX-indent-end-list' and generates
the regexp's which are stored in
`LaTeX-indent-begin-regexp-local',
`LaTeX-indent-begin-regexp-exceptions-local',
`LaTeX-indent-mid-regexp-local' and
`LaTeX-indent-end-regexp-local' accordingly.  Some standard
macros are added to the regexp's.  This function is called in
`LaTeX-mode-cleanup' to set the regexp's."
  (let* (cmds
         symbs
         (func (lambda (in regexp out)
                 (setq cmds nil
                       symbs nil)
                 (dolist (elt in)
                   (if (string-match "[^a-zA-Z@]" elt)
                       (push elt symbs)
                     (push elt cmds)))
                 (set out (concat regexp
                                  (when cmds
                                    (concat "\\|"
                                            (regexp-opt cmds)
                                            "\\b"))
                                  (when symbs
                                    (concat "\\|"
                                            (regexp-opt symbs))))))))
    (funcall func
             LaTeX-indent-begin-list
             "if[a-zA-Z@:_]*\\b"
             'LaTeX-indent-begin-regexp-local)
    (funcall func
             LaTeX-indent-mid-list
             "else:?\\b\\|or\\b"
             'LaTeX-indent-mid-regexp-local)
    (funcall func
             LaTeX-indent-end-list
             "fi:?\\b\\|repeat\\b"
             'LaTeX-indent-end-regexp-local)
    (funcall func
             LaTeX-indent-begin-exceptions-list
             "ifthenelse\\b\\|iff\\b"
             'LaTeX-indent-begin-regexp-exceptions-local)))