Function: LaTeX-indent-level-count

LaTeX-indent-level-count is a byte-compiled function defined in latex.el.

Signature

(LaTeX-indent-level-count)

Documentation

Count indentation change caused by macros in the current line.

Macros contain \left, \right, \begin, \end and \if-\fi constructs. A special case is \newif where the following
\if<foo> should not change the indentation.

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-indent-level-count ()
  "Count indentation change caused by macros in the current line.
Macros contain \\left, \\right, \\begin, \\end and \\if-\\fi
constructs.  A special case is \\newif where the following
\\if<foo> should not change the indentation."
  (save-excursion
    (save-restriction
      (let ((count 0))
        (narrow-to-region (point)
                          (save-excursion
                            (re-search-forward
                             (concat "[^" TeX-esc "]"
                                     "\\(" LaTeX-indent-comment-start-regexp
                                     "\\)\\|\n\\|\\'"))
                            (backward-char)
                            (point)))
        (while (search-forward TeX-esc nil t)
          (cond
           ((looking-at "left\\b")
            (setq count (+ count LaTeX-left-right-indent-level)))
           ((looking-at "right\\b")
            (setq count (- count LaTeX-left-right-indent-level)))
           ((looking-at LaTeX-begin-regexp)
            (setq count (+ count LaTeX-indent-level)))
           ((looking-at LaTeX-end-regexp)
            (setq count (- count LaTeX-indent-level)))
           ((looking-at "newif\\b")
            (search-forward TeX-esc (line-end-position) t))
           ((and (not (looking-at LaTeX-indent-begin-regexp-exceptions-local))
                 (looking-at LaTeX-indent-begin-regexp-local))
            (setq count (+ count LaTeX-indent-level)))
           ((looking-at LaTeX-indent-end-regexp-local)
            (setq count (- count LaTeX-indent-level)))
           ((looking-at (regexp-quote TeX-esc))
            (forward-char 1))))
        count))))