Function: LaTeX--find-preceding-left-macro-name

LaTeX--find-preceding-left-macro-name is a byte-compiled function defined in latex.el.

Signature

(LaTeX--find-preceding-left-macro-name)

Documentation

Return the left macro name just before the point, if any.

If the preceding macro isn't left macros such as \left, \bigl etc., return nil. If the point is just after unescaped TeX-esc, return the null string.

Aliases

LaTeX-find-preceeding-left-macro-name (obsolete since AUCTeX 12.2)

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defun LaTeX--find-preceding-left-macro-name ()
  "Return the left macro name just before the point, if any.
If the preceding macro isn't left macros such as \\left, \\bigl etc.,
return nil.
If the point is just after unescaped `TeX-esc', return the null string."
  ;; \left-!- => "left"
  ;; \-!- => ""
  ;; \infty-!- => nil
  ;; \&-!- => nil
  ;; \mathrm{abc}-!- => nil
  ;; {blah blah blah}-!- => nil
  ;; \\-!- => nil
  (let ((name (buffer-substring-no-properties
               (point)
               ;; This is only a helper function, so we do not
               ;; preserve point by save-excursion.
               (progn
                 ;; Assume left macro names consist of only A-Z and a-z.
                 (skip-chars-backward "A-Za-z")
                 (point)))))
    (if (and (TeX-escaped-p)
             (or (string= name "")
                 (assoc name LaTeX-left-right-macros-association)))
        name)))