branch: externals/auctex commit bf66b302a4afa297fc2322a875935fd9a4d47525 Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Improve the previous commit slightly * latex.el (LaTeX-current-environment,LaTeX-backward-up-environment): Move the task to find out the environment name from the latter to the former. --- latex.el | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/latex.el b/latex.el index 8d181f6982..7c29306642 100644 --- a/latex.el +++ b/latex.el @@ -905,16 +905,21 @@ environment in commented regions with the same comment prefix. The functions `LaTeX-find-matching-begin' and `LaTeX-find-matching-end' work analogously." - (or (save-excursion (LaTeX-backward-up-environment arg t)) - "document")) + (save-excursion + (if (LaTeX-backward-up-environment arg) + (progn + (re-search-forward (concat + TeX-grop (LaTeX-environment-name-regexp) + TeX-grcl)) + (match-string-no-properties 1)) + "document"))) -(defun LaTeX-backward-up-environment (&optional arg want-name) +(defun LaTeX-backward-up-environment (&optional arg) "Move backward out of the enclosing environment. Helper function of `LaTeX-current-environment' and `LaTeX-find-matching-begin'. With optional ARG>=1, find that outer level. Return non-nil if the operation succeeded. -Return the (outermost) environment name if WANT-NAME is non-nil. Assume the current point is on neither \"begin{foo}\" nor \"end{foo}\"." (setq arg (if arg (if (< arg 1) 1 arg) 1)) @@ -943,13 +948,7 @@ Assume the current point is on neither \"begin{foo}\" nor \"end{foo}\"." (setq arg (if (= (char-after (match-beginning 1)) ?e) (1+ arg) (1- arg))))) - (if (= arg 0) - (or (not want-name) - (progn - (looking-at (concat (regexp-quote TeX-esc) "begin *" - TeX-grop (LaTeX-environment-name-regexp) - TeX-grcl)) - (match-string-no-properties 1)))))) + (= arg 0))) (defun docTeX-in-macrocode-p () "Determine if point is inside a macrocode environment."