Hi Tassilo,

>>>>> Tassilo Horn <[email protected]> writes:
> Ok, I've pushed two commits to master, each one fixing one spot
> introducing duplicate entries.

> modified   latex.el
> @@ -6217,8 +6217,9 @@ function would return non-nil and `(match-string 1)' 
> would return
>                      (cons (concat "\\" (nth 0 x)) (nth 1 x)))
>                    LaTeX-section-list)))
 
> -  (set (make-local-variable 'TeX-auto-full-regexp-list)
> -       (append LaTeX-auto-regexp-list plain-TeX-auto-regexp-list))
> +  (setq-local TeX-auto-full-regexp-list
> +              (delete-dups (append LaTeX-auto-regexp-list
> +                                   plain-TeX-auto-regexp-list)))

As discussed previously[1], `delete-dups'+`append' can be dangerous as
they may truncate list variable inadvertently. Though I think this
particular case is unlikely to suffer from such truncation, I'd propse
to install the attached defensive code. What do you think about this?

Regards,
Ikumi Keita

[1]https://lists.gnu.org/archive/html/auctex-devel/2017-09/msg00010.html

>From 34e58334d86d10e489d6f77179a310c88f019bc1 Mon Sep 17 00:00:00 2001
From: Ikumi Keita <[email protected]>
Date: Wed, 20 Jan 2021 17:45:31 +0900
Subject: [PATCH] Prevent inadvertent destruction of list variable

* latex.el (LaTeX-common-initialization): Apply `copy-sequence' to the
last argument of `delete-dups'+`append'.
---
 latex.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/latex.el b/latex.el
index 6a8b2fd5..b4fd7d38 100644
--- a/latex.el
+++ b/latex.el
@@ -6219,7 +6219,10 @@ function would return non-nil and `(match-string 1)' would return
 
   (setq-local TeX-auto-full-regexp-list
               (delete-dups (append LaTeX-auto-regexp-list
-                                   plain-TeX-auto-regexp-list)))
+                                   ;; Prevent inadvertent destruction
+                                   ;; of `plain-TeX-auto-regexp-list'.
+                                   (copy-sequence
+                                    plain-TeX-auto-regexp-list))))
 
   (LaTeX-set-paragraph-start)
   (setq paragraph-separate
-- 
2.30.0

Reply via email to