branch: externals/auctex commit 287da56401c7e8d465cc60844756162d49c6bb22 Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
Revert "Bind a value to `LaTeX-current-environment' locally" This reverts commit e4ceb88bb7cb4f406874de196aa71118449fe373. This change had negative side effects for indentation. See https://lists.gnu.org/archive/html/auctex-devel/2022-11/msg00057.html --- latex.el | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/latex.el b/latex.el index 6303c3371f..69924b2152 100644 --- a/latex.el +++ b/latex.el @@ -572,11 +572,11 @@ Styles such as tabularx may set it according to their needs.") (defvar LaTeX-environment-history nil) -(defvar LaTeX-current-environment nil - "Cache holding the name of current enviroment for repeated tasks. -Example for a repeated task is indenting each line in a paragraph -to be filled. Therefore, this variable is meant to be let-bound -in a function and nil globally.") +;; Variable used to cache the current environment, e.g. for repeated +;; tasks in an environment, like indenting each line in a paragraph to +;; be filled. It must not have a non-nil value in general. That +;; means it is usually let-bound for such operations. +(defvar LaTeX-current-environment nil) (defun LaTeX-environment (arg) "Make LaTeX environment (\\begin{...}-\\end{...} pair). @@ -1114,10 +1114,9 @@ The first item is inserted by the function `LaTeX--env-item'." (defun LaTeX-env-item-args (environment &rest args) "Insert ENVIRONMENT followed by ARGS and first item. The first item is inserted by the function `LaTeX--env-item'." - (let ((LaTeX-current-environment environment)) - (LaTeX-insert-environment environment) - (LaTeX--env-parse-args args) - (LaTeX--env-item environment))) + (LaTeX-insert-environment environment) + (LaTeX--env-parse-args args) + (LaTeX--env-item environment)) (defcustom LaTeX-label-alist '(("figure" . LaTeX-figure-label) @@ -1329,9 +1328,8 @@ Just like array and tabular." (defun LaTeX-env-label-args (environment &rest args) "Run `LaTeX-env-label' on ENVIRONMENT and insert ARGS." - (let ((LaTeX-current-environment environment)) - (LaTeX-env-label environment) - (LaTeX--env-parse-args args))) + (LaTeX-env-label environment) + (LaTeX--env-parse-args args)) (defun LaTeX-env-list (environment) "Insert ENVIRONMENT and the first item." @@ -1458,9 +1456,8 @@ Just like array and tabular." (defun LaTeX-env-args (environment &rest args) "Insert ENVIRONMENT and arguments defined by ARGS." - (let ((LaTeX-current-environment environment)) - (LaTeX-insert-environment environment) - (LaTeX--env-parse-args args))) + (LaTeX-insert-environment environment) + (LaTeX--env-parse-args args)) (defun LaTeX-env-label-as-keyval (_optional &optional keyword keyvals environment) "Query for a label and insert it in the optional argument of an environment.