Function: LaTeX-indent-tabular
LaTeX-indent-tabular is a byte-compiled function defined in latex.el.
Signature
(LaTeX-indent-tabular)
Documentation
Return indent column for the current tabular-like line.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX-indent-tabular ()
"Return indent column for the current tabular-like line."
(cl-destructuring-bind
(beg-pos . beg-col)
(LaTeX-env-beginning-pos-indent)
(let ((tabular-like-end-regex
(format "\\\\end{%s}"
(regexp-opt
(let (out)
(mapc (lambda (x)
(when (eq (cadr x) #'LaTeX-indent-tabular)
(push (car x) out)))
LaTeX-indent-environment-list)
out)))))
(cond ((looking-at tabular-like-end-regex)
beg-col)
((looking-at "\\\\\\\\")
(+ 2 beg-col))
((looking-at "&")
(LaTeX-hanging-ampersand-position beg-pos beg-col))
(t
(+ 2
(let ((any-col
(save-excursion
(when
(catch 'found
;; Search "\\" or "&" which belongs to
;; the current env, not an inner env.
(while (re-search-backward
"\\\\\\\\\\|[^\\]&" beg-pos t)
(let ((p (point)))
(when (= beg-pos
(progn
(LaTeX-find-matching-begin)
(point)))
;; It belongs to the current env.
;; Go to target position and exit
;; the loop.
(goto-char (1+ p))
(throw 'found t)
;; Otherwise it belongs to an
;; inner env, so continue the
;; loop.
))))
;; If we found "&", then use its column as
;; `any-col'. Else, `any-col' will be nil.
(if (= ?& (char-after))
(current-column))))))
(or any-col
beg-col))))))))