[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex b95c47a1c2 07/10: Fix and enhance pseudo-parent
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex b95c47a1c2 07/10: Fix and enhance pseudo-parent mode facility (bug#69069) |
Date: |
Tue, 20 Feb 2024 01:10:15 -0500 (EST) |
branch: externals/auctex
commit b95c47a1c268ac6b6dc28e292bb67cd32c263a53
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
Fix and enhance pseudo-parent mode facility (bug#69069)
* tex-info.el: Fill in missing pseudo-parent relation for
`Texinfo-mode'.
; Update copyright year.
* tex.el (TeX--compat-provided-mode-derived-p): Rename from
`TeX--compat-derived-mode-p' and extend psuedo-parent mode facility,
which was formerly restricted to `derived-mode-p', to support
`provided-mode-derived-p'.
* tests/tex/utility.el (TeX-pseudo-parent-mode): Add a new test.
; Update copyright year.
* tests/latex/latex-test.el (LaTeX-align): Add a new test.
(AUCTeX-set-ert-path): Add paths for the new test.
; Update copyright year.
* tests/latex/align-in.tex:
* tests/latex/align-out.tex:
New files for the new test.
* latex.el:
* plain-tex.el:
* tex-jp.el:
Add `tex-mode' explicitly to the pseudo-parents of `LaTeX-mode',
`docTeX-mode', `plain-TeX-mode', `japanese-plain-TeX-mode' and
`japanese-LaTeX-mode' for compatibility with Emacs<30.
; Update copyright year.
---
latex.el | 8 ++++++--
plain-tex.el | 4 +++-
tests/latex/align-in.tex | 9 +++++++++
tests/latex/align-out.tex | 9 +++++++++
tests/latex/latex-test.el | 21 ++++++++++++++++++++-
tests/tex/utility.el | 19 ++++++++++++++++++-
tex-info.el | 7 ++++++-
tex-jp.el | 11 +++++++----
tex.el | 23 ++++++++++++-----------
9 files changed, 90 insertions(+), 21 deletions(-)
diff --git a/latex.el b/latex.el
index ff8d7a8502..f077acd4ca 100644
--- a/latex.el
+++ b/latex.el
@@ -8333,7 +8333,9 @@ Run after mode hooks and file local variables
application."
;; Compatibility for former mode name. Directory local variables
;; prepared for `latex-mode' continue to be valid for `LaTeX-mode'.
-(TeX-derived-mode-add-parents 'LaTeX-mode '(latex-mode))
+;; COMPATIBILITY for emacs<30: `tex-mode' can be removed from the list
+;; once the least supported emacsen becomes 30.
+(TeX-derived-mode-add-parents 'LaTeX-mode '(latex-mode tex-mode))
(with-eval-after-load 'semantic/symref/grep
(push '(docTeX-mode "*.dtx") semantic-symref-filepattern-alist))
@@ -8370,7 +8372,9 @@ runs the hooks in `docTeX-mode-hook'."
;; prepared for `doctex-mode' continue to be valid for `docTeX-mode'.
;; In addition, dir local vars for `latex-mode' are now valid for
;; `docTeX-mode' as well.
-(TeX-derived-mode-add-parents 'docTeX-mode '(doctex-mode latex-mode))
+;; COMPATIBILITY for emacs<30: `latex-mode' and `tex-mode' can be removed
+;; from the list once the least supported emacsen becomes 30.
+(TeX-derived-mode-add-parents 'docTeX-mode '(doctex-mode latex-mode tex-mode))
(defcustom docTeX-clean-intermediate-suffixes
TeX-clean-default-intermediate-suffixes
diff --git a/plain-tex.el b/plain-tex.el
index 76de05e25d..5691859d2b 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -155,7 +155,9 @@ Run after mode hooks and file local variables application."
;; Compatibility for former mode name. Directory local variables
;; prepared for `plain-tex-mode' continue to be valid for
;; `plain-TeX-mode'.
-(TeX-derived-mode-add-parents 'plain-TeX-mode '(plain-tex-mode))
+;; COMPATIBILITY for emacs<30: `tex-mode' can be removed from the list
+;; once the least supported emacsen becomes 30.
+(TeX-derived-mode-add-parents 'plain-TeX-mode '(plain-tex-mode tex-mode))
(defun plain-TeX-common-initialization ()
"Common initialization for plain TeX like modes."
diff --git a/tests/latex/align-in.tex b/tests/latex/align-in.tex
new file mode 100644
index 0000000000..b2c8a99ef4
--- /dev/null
+++ b/tests/latex/align-in.tex
@@ -0,0 +1,9 @@
+\documentclass{article}
+\begin{document}
+% Broken by new mode name (Bug#69069)
+\begin{tabular}{cccc}
+ Mat.-Nr. & Nachname & Vorname & Unterschrift \\
+ Mat. No. & Surname & Name & Signature
+\end{tabular}
+
+\end{document}
diff --git a/tests/latex/align-out.tex b/tests/latex/align-out.tex
new file mode 100644
index 0000000000..b2c8a99ef4
--- /dev/null
+++ b/tests/latex/align-out.tex
@@ -0,0 +1,9 @@
+\documentclass{article}
+\begin{document}
+% Broken by new mode name (Bug#69069)
+\begin{tabular}{cccc}
+ Mat.-Nr. & Nachname & Vorname & Unterschrift \\
+ Mat. No. & Surname & Name & Signature
+\end{tabular}
+
+\end{document}
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index eae951f115..e22d2a0835 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,6 +1,6 @@
;;; latex-test.el --- tests for LaTeX mode -*- lexical-binding: t; -*-
-;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
@@ -53,6 +53,10 @@
"nested-indent-in.tex"
'LaTeX-nested-indent/out
"nested-indent-out.tex"
+ 'LaTeX-align/in
+ "align-in.tex"
+ 'LaTeX-align/out
+ "align-out.tex"
'docTeX/in
"doctex-indent-in.dtx"
'docTeX/out
@@ -696,6 +700,21 @@ check the indentation for optional argument of
\\usepackage."
(insert-file-contents LaTeX-conditionals-indent/out)
(buffer-string)))))
+(ert-deftest LaTeX-align ()
+ "Test if align.el works correctly."
+ (should (string=
+ (with-temp-buffer
+ (insert-file-contents LaTeX-align/in)
+ (goto-char (point-min))
+ (LaTeX-mode)
+ (search-forward "\\begin{")
+ (forward-line 1)
+ (align-current)
+ (buffer-string))
+ (with-temp-buffer
+ (insert-file-contents LaTeX-align/out)
+ (buffer-string)))))
+
(ert-deftest docTeX-indentation ()
"Test if content in docTeX-mode is indented correctly."
(should (string=
diff --git a/tests/tex/utility.el b/tests/tex/utility.el
index ac0a8aab8f..211555a8a6 100644
--- a/tests/tex/utility.el
+++ b/tests/tex/utility.el
@@ -1,6 +1,6 @@
;;; utility.el --- tests for AUCTeX utility functions -*- lexical-binding: t;
-*-
-;; Copyright (C) 2017, 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2021, 2024 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
@@ -55,4 +55,21 @@
(TeX-add-to-alist 'TeX-dummy-alist '((a a)))
(should (equal TeX-dummy-alist '((b 2 3) (a 1 4 a)))))
+(ert-deftest TeX-pseudo-parent-mode ()
+ "Check pseudo parent modes are recognized.
+For example, `LaTeX-mode' should be regarded as derived from
+`latex-mode' for compatibility with the former mode names."
+ (require 'plain-tex)
+ (require 'latex)
+ (require 'tex-info)
+ (require 'context)
+ (require 'tex-jp)
+ (dolist (mode-pair TeX-mode-comparison-alist)
+ (should (provided-mode-derived-p (cdr mode-pair) (car mode-pair)))
+ ;; In addition, several modes should be regarded as derived from
+ ;; `tex-mode' for better compatibility with other packages and
+ ;; Emacs core.
+ (unless (memq (cdr mode-pair) '(Texinfo-mode ConTeXt-mode AmSTeX-mode))
+ (should (provided-mode-derived-p (cdr mode-pair) 'tex-mode)))))
+
;;; utility.el ends here
diff --git a/tex-info.el b/tex-info.el
index 63242e0df7..fc10f0184f 100644
--- a/tex-info.el
+++ b/tex-info.el
@@ -1,6 +1,6 @@
;;; tex-info.el --- Support for editing Texinfo source. -*- lexical-binding:
t; -*-
-;; Copyright (C) 1993-2023 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2024 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Keywords: tex
@@ -890,6 +890,11 @@ Run after mode hooks and file local variables application."
(TeX-set-mode-name))
+;; Compatibility for former mode name. Directory local variables
+;; prepared for `texinfo-mode' continue to be valid for
+;; `Texinfo-mode'.
+(TeX-derived-mode-add-parents 'Texinfo-mode '(texinfo-mode))
+
(defcustom Texinfo-clean-intermediate-suffixes
'("\\.cps?" "\\.vrs?" "\\.fns?" "\\.tps?" "\\.pgs?" "\\.kys?")
"List of regexps matching suffixes of files to be deleted.
diff --git a/tex-jp.el b/tex-jp.el
index cdb62d974f..704ef8022a 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -1,7 +1,6 @@
;;; tex-jp.el --- Support for Japanese TeX. -*- lexical-binding: t; -*-
-;; Copyright (C) 1999, 2001-2008, 2012-2013, 2016-2018, 2020-2023
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1999-2024 Free Software Foundation, Inc.
;; Author: KOBAYASHI Shinji <koba@flab.fujitsu.co.jp>,
;; Hidenobu Nabetani <nabe@debian.or.jp>
@@ -427,8 +426,10 @@ Now `japanese-plain-tex-mode-initialization' is no-op.
Don't use it."))
;; Compatibility for former mode name. Directory local variables
;; prepared for `japanese-plain-tex-mode' and `plain-tex-mode'
;; continue to be valid for `japanese-plain-TeX-mode'.
+;; COMPATIBILITY for emacs<30: `plain-tex-mode' and `tex-mode' can be
+;; removed from the list once the least supported emacsen becomes 30.
(TeX-derived-mode-add-parents 'japanese-plain-TeX-mode
- '(japanese-plain-tex-mode plain-tex-mode))
+ '(japanese-plain-tex-mode plain-tex-mode
tex-mode))
;;;###autoload
(define-derived-mode japanese-LaTeX-mode LaTeX-mode "LaTeX"
@@ -479,8 +480,10 @@ Now `japanese-latex-mode-initialization' is no-op. Don't
use it."))
;; Compatibility for former mode name. Directory local variables
;; prepared for `japanese-latex-mode' and `latex-mode' continue to be
;; valid for `japanese-LaTeX-mode'.
+;; COMPATIBILITY for emacs<30: `latex-mode' and `tex-mode' can be
+;; removed from the list once the least supported emacsen becomes 30.
(TeX-derived-mode-add-parents 'japanese-LaTeX-mode
- '(japanese-latex-mode latex-mode))
+ '(japanese-latex-mode latex-mode tex-mode))
(defun japanese-LaTeX-guess-engine ()
"Guess Japanese TeX engine and set it to `TeX-engine'.
diff --git a/tex.el b/tex.el
index 8396c9493e..9987937a0b 100644
--- a/tex.el
+++ b/tex.el
@@ -3887,18 +3887,19 @@ Run after mode hooks and file local variables
application."
;; COMPATIBILITY for Emacs<30
(unless (fboundp 'derived-mode-add-parents)
- (advice-add 'derived-mode-p :after-until
+ (advice-add 'provided-mode-derived-p :after-until
;; Don't quote by #'-style to avoid compiler warning.
- 'TeX--compat-derived-mode-p)
- (defun TeX--compat-derived-mode-p (&rest modes)
- "Add pseudo-parents facility to `derived-mode-p' like Emacs 30.
-Modes registered in `derived-mode-extra-parents' property of the
-current major mode name symbol are regarded as parent modes as
-long as `derived-mode-p' is concerned."
- (let ((extra-parents (get major-mode 'derived-mode-extra-parents)))
- (and extra-parents
- (cl-loop for parent in extra-parents
- thereis (memq parent modes))))))
+ 'TeX--compat-provided-mode-derived-p)
+ (defun TeX--compat-provided-mode-derived-p (mode &rest modes)
+ "Add pseudo-parents facility to `provided-mode-derived-p' like Emacs 30.
+Modes registered in `derived-mode-extra-parents' property of MODE
+symbol are regarded as parent modes by `provided-mode-derived-p',
+when MODE is one of the AUCTeX new mode names."
+ (when (rassq mode TeX-mode-comparison-alist)
+ (let ((extra-parents (get mode 'derived-mode-extra-parents)))
+ (and extra-parents
+ (cl-loop for parent in extra-parents
+ thereis (memq parent modes)))))))
;;; Hilighting
- [elpa] externals/auctex updated (b3e1ab1b9f -> 59d74b08a5), Tassilo Horn, 2024/02/20
- [elpa] externals/auctex 299cf53d24 05/10: * style/cancel.el (LaTeX-cancel-package-options): Fix options., Tassilo Horn, 2024/02/20
- [elpa] externals/auctex 4b77d8ebaa 02/10: * doc/faq.texi: Add FAQ entry for ELPA upgrade failure., Tassilo Horn, 2024/02/20
- [elpa] externals/auctex 6c18df7f10 09/10: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2024/02/20
- [elpa] externals/auctex b95c47a1c2 07/10: Fix and enhance pseudo-parent mode facility (bug#69069),
Tassilo Horn <=
- [elpa] externals/auctex 32fe3f2c3b 01/10: Cater for former mode name in customized `TeX-command-list', Tassilo Horn, 2024/02/20
- [elpa] externals/auctex 49f46a2c4f 08/10: Fix position of `LaTeX--arguments-completion-at-point', Tassilo Horn, 2024/02/20
- [elpa] externals/auctex d150b0f1b1 06/10: ; Add comments, Tassilo Horn, 2024/02/20
- [elpa] externals/auctex 09a181fa14 04/10: Increase description of `TeX-modes' in the document, Tassilo Horn, 2024/02/20
- [elpa] externals/auctex 59d74b08a5 10/10: Regenerate after merge from master, Tassilo Horn, 2024/02/20
- [elpa] externals/auctex fd7b5aacfa 03/10: ; * doc/faq.texi: Update copyright year., Tassilo Horn, 2024/02/20