Function: TeX-arg-insert-right-brace-maybe
TeX-arg-insert-right-brace-maybe is a byte-compiled function defined
in latex.el.
Signature
(TeX-arg-insert-right-brace-maybe OPTIONAL)
Documentation
Insert the suitable right brace macro such as \rangle.
Insertion is done when TeX-arg-right-insert-p is non-nil.
If the left brace macro is preceded by \left, \bigl etc.,
supply the corresponding macro such as \right before the right brace macro.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/latex.el
(defvar TeX-arg-right-insert-p) ;; Defined further below.
(defun TeX-arg-insert-right-brace-maybe (optional)
"Insert the suitable right brace macro such as \\rangle.
Insertion is done when `TeX-arg-right-insert-p' is non-nil.
If the left brace macro is preceded by \\left, \\bigl etc.,
supply the corresponding macro such as \\right before the right brace macro."
;; Nothing is done when TeX-arg-right-insert-p is nil.
(when TeX-arg-right-insert-p
(let (left-brace left-macro)
(save-excursion
;; Obtain left brace macro name such as "\langle".
(setq left-brace (buffer-substring-no-properties
(point)
(progn (backward-word) (backward-char)
(point)))
;; Obtain the name of preceding left macro, if any,
;; such as "left", "bigl" etc.
left-macro (LaTeX--find-preceding-left-macro-name)))
(save-excursion
(if (TeX-active-mark)
(goto-char (mark)))
(LaTeX-insert-corresponding-right-macro-and-brace
left-macro left-brace optional)))))