>From 6b6c39654e028c85e8e0fd5859fac5f95cab3b3f Mon Sep 17 00:00:00 2001 From: Ikumi Keita Date: Sun, 11 Feb 2024 14:48:27 +0900 Subject: [PATCH] Cater for former mode name in customized `TeX-command-list' * tex.el (TeX-mode-comparison-alist): Comparison table for former and new mode names. (TeX-mode-specific-command-list): Compare the former mode name as well against the mode list in `TeX-command-list'. --- tex.el | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tex.el b/tex.el index 49723108..2dacbad4 100644 --- a/tex.el +++ b/tex.el @@ -103,6 +103,19 @@ (defvar compilation-error-regexp-alist) ; compile.el (defvar compilation-in-progress) ; compile.el +(defconst TeX-mode-comparison-alist + '((plain-tex-mode . plain-TeX-mode) + (latex-mode . LaTeX-mode) + (doctex-mode . docTeX-mode) + (context-mode . ConTeXt-mode) + (texinfo-mode . Texinfo-mode) + (ams-tex-mode . AmSTeX-mode) + (japanese-plain-tex-mode . japanese-plain-TeX-mode) + (japanese-latex-mode . japanese-LaTeX-mode)) + "Comparison table of AUCTeX former and current mode names. +Each entry is of the form (FORMER . CURRENT) where FORMER and +CURRENT are each mode name symbols.") + (defgroup TeX-file nil "Files used by AUCTeX." :group 'AUCTeX) @@ -5207,12 +5220,20 @@ Brace insertion is only done if point is in a math construct and "Return the list of commands available in the given MODE." (let ((full-list TeX-command-list) out-list - entry) + entry fourth-entry + former-mode) (while (setq entry (pop full-list)) + (setq fourth-entry (nth 4 entry)) ;; `(nth 4 entry)' may be either an atom in case of which the ;; entry should be present in any mode or a list of major modes. - (if (or (atom (nth 4 entry)) - (memq mode (nth 4 entry))) + (if (or (atom fourth-entry) + (memq mode fourth-entry) + ;; Compatibility for former mode names. The user can + ;; have customized `TeX-command-list' with former mode + ;; names listed in `(nth 4 entry)'. + (and (setq former-mode (car + (rassq mode TeX-mode-comparison-alist))) + (memq former-mode fourth-entry))) (push entry out-list))) (nreverse out-list))) -- 2.43.0