auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

main 6c18df7f 249/257: Merge remote-tracking branch 'origin/master' into


From: Tassilo Horn
Subject: main 6c18df7f 249/257: Merge remote-tracking branch 'origin/master' into externals/auctex
Date: Fri, 19 Apr 2024 15:37:08 -0400 (EDT)

branch: main
commit 6c18df7f10756d3dddf072340b75f9ced4dd8ef2
Merge: b3e1ab1b 49f46a2c
Author: Tassilo Horn <tsdh@gnu.org>
Commit: Tassilo Horn <tsdh@gnu.org>

    Merge remote-tracking branch 'origin/master' into externals/auctex
---
 doc/faq.texi              | 57 ++++++++++++++++++++++++++++++++++++++++++++++-
 doc/install.texi          | 28 +++++++++++++++++++----
 latex.el                  | 12 +++++++---
 plain-tex.el              |  6 ++++-
 style/cancel.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                    | 51 ++++++++++++++++++++++++++++++------------
 12 files changed, 202 insertions(+), 32 deletions(-)

diff --git a/doc/faq.texi b/doc/faq.texi
index 0fb58dd5..cd71ac95 100644
--- a/doc/faq.texi
+++ b/doc/faq.texi
@@ -1,5 +1,5 @@
 @c This is part of the AUCTeX Manual.
-@c Copyright (C) 2004-2023 Free Software Foundation, Inc.
+@c Copyright (C) 2004-2024 Free Software Foundation, Inc.
 @c See the file auctex.texi for copying conditions.
 @ifset rawfile
 @include macros.texi
@@ -13,6 +13,10 @@
 @item
 Something is not working correctly.  What should I do?
 
+If you are having trouble with upgrading @acronym{ELPA} package, first
+have a look at the dedicated entry below.  If that doesn't resolve your
+issue, then come back here and proceed.
+
 Well, you might have guessed it, the first place to look is in the
 available documentation packaged with @AUCTeX{}.  This could be the
 release notes (in the @file{RELEASE} file) or the news section of the
@@ -68,6 +72,57 @@ error.  If everything is working now, you know that you have 
to search
 either in the site configuration file or your personal init file for
 statements related to the problem.
 
+@item
+@acronym{ELPA} upgrade fails.  What should I do?
+
+In general, @acronym{ELPA} upgrade can fail in a Emacs session you are
+running, especially when @AUCTeX{} major version increases.  This entry
+covers the following cases in such casual upgrade.
+@itemize
+@item
+Upgrade stops with error and doesn't complete.
+@item
+Upgrade falls in infinite loop and doesn't terminate.  You have
+to interrupt it with @kbd{C-g} and upgrade doesn't complete.
+@item
+It looks like upgrade finishes successfully but afterwards @AUCTeX{}
+breaks with mysterious error like:
+@example
+TeX-command-expand: Wrong type argument: stringp, nil
+@end example
+
+@end itemize
+
+These issues involve byte compilation failure.  In the third case, the
+generated @file{.elc} files are actually corrupted.  Thus the point is to
+have sane byte compilation.
+
+The first thing which is worth trying is:
+@enumerate
+@item
+Terminate the current running Emacs session and restart Emacs.
+@item
+Type @kbd{M-x package-recompile @key{RET} auctex @key{RET}}.
+@item
+Restart your Emacs again.
+@end enumerate
+
+If you are lucky enough, this will basically resolve the issue.  There is
+still old @samp{auctex-X.Y.Z} directory left behind under
+@file{~/.emacs.d/elpa/}, so delete it manually to avoid future trouble.
+
+If the above prescription doesn't work, then try:
+@enumerate
+@item
+Uninstall @AUCTeX{} once.
+@item
+Restart your Emacs and (before doing anything else) reinstall @AUCTeX{}.
+@end enumerate
+
+In theory, this recipe will circumvent all caveats in @acronym{ELPA}
+upgrade of @AUCTeX{}.  Find and delete old @samp{auctex-X.Y.Z} directory
+remaining under @file{~/.emacs.d/elpa/}.
+
 @item
 What versions of Emacs are supported?
 
diff --git a/doc/install.texi b/doc/install.texi
index 52be62f9..c2499e63 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -1,6 +1,6 @@
 @c This is part of the AUCTeX Manual.
 @c Copyright (C) 1994, 1996, 2003-2007, 2012-2013,
-@c               2015-2023  Free Software Foundation, Inc.
+@c               2015-2024  Free Software Foundation, Inc.
 @c See the file auctex.texi for copying conditions.
 @ifset rawfile
 @include macros.texi
@@ -353,11 +353,31 @@ below.
 @end ifclear
 
 Once activated, the modes provided by @AUCTeX{} are used per default for
-all supported file types.  If you want to change the modes for which it
-is operative instead of the default, use
+all supported file types, namely @code{plain-tex-mode}, @code{latex-mode},
+@code{doctex-mode} and @code{texinfo-mode}.  This might not match your
+preference.  You can have control over which @AUCTeX{} mode is activated
+per file types by @code{TeX-modes} option.  For example, you can use Emacs
+built-in @code{plain-tex-mode} for plain @TeX{} files while you can use
+@AUCTeX{} @code{LaTeX-mode} for @LaTeX{} files.
+
+@defopt TeX-modes
+List of Emacs built-in @TeX{} modes redirected to @AUCTeX{} modes.  If you
+prefer a particular built-in mode over @AUCTeX{} mode, remove it from this
+list.  Type
 @example
 @kbd{M-x customize-option @key{RET} TeX-modes @key{RET}}
 @end example
+@noindent
+to manipulate the contents of @code{TeX-modes}.
+@end defopt
+
+Don't remove @code{tex-mode} from @code{TeX-modes} because it results in
+inconsistent behavior.
+
+On Emacs 29 and later, you can alter @code{major-mode-remap-alist} instead
+of @code{TeX-modes} as you like to arrange @AUCTeX{} redirections.  In
+fact, @code{TeX-modes} option does nothing other than setting up
+@code{major-mode-remap-alist} according its value on those Emacsens.
 
 If you want to remove a preinstalled @AUCTeX{} completely before any of
 its modes have been used,
@@ -365,7 +385,7 @@ its modes have been used,
 (unload-feature 'tex-site)
 @end lisp
 @noindent
-should accomplish that.
+in your init file should accomplish that.
 
 @node Advice for package providers
 @section Providing @AUCTeX{} as a package
diff --git a/latex.el b/latex.el
index 1b9a1656..83de0e84 100644
--- a/latex.el
+++ b/latex.el
@@ -8214,6 +8214,8 @@ This happens when \\left is inserted."
 
 (declare-function LaTeX-preview-setup "preview")
 
+;; Delete alias predefined in tex-mode.el so that AUCTeX autoload
+;; takes precedence.
 ;;;###autoload (if (eq (symbol-function 'LaTeX-mode) 'latex-mode)
 ;;;###autoload     (defalias 'LaTeX-mode nil))
 ;;;###autoload
@@ -8331,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))
@@ -8368,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
@@ -8473,7 +8479,7 @@ function would return non-nil and `(match-string 1)' 
would return
   ;; Standard Emacs completion-at-point support.  We append the entry
   ;; in order to let `TeX--completion-at-point' be first in the list:
   (add-hook 'completion-at-point-functions
-            #'LaTeX--arguments-completion-at-point t t)
+            #'LaTeX--arguments-completion-at-point 5 t)
 
   (set (make-local-variable 'LaTeX-item-list) '(("description" . 
LaTeX-item-argument)
                                                 ("thebibliography" . 
LaTeX-item-bib)
diff --git a/plain-tex.el b/plain-tex.el
index e3ffd53d..5691859d 100644
--- a/plain-tex.el
+++ b/plain-tex.el
@@ -115,6 +115,8 @@ plain-TeX file, or any mode derived thereof.  See variable
 
 (TeX-abbrev-mode-setup plain-TeX-mode plain-tex-mode-abbrev-table)
 
+;; Delete alias predefined in tex-mode.el so that AUCTeX autoload
+;; takes precedence.
 ;;;###autoload (if (eq (symbol-function 'plain-TeX-mode) 'plain-tex-mode)
 ;;;###autoload     (defalias 'plain-TeX-mode nil))
 ;;;###autoload
@@ -153,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/style/cancel.el b/style/cancel.el
index 765fe684..b558eb51 100644
--- a/style/cancel.el
+++ b/style/cancel.el
@@ -1,6 +1,6 @@
 ;;; cancel.el --- AUCTeX style for `cancel.sty'  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2021 Free Software Foundation, Inc.
+;; Copyright (C) 2021--2024 Free Software Foundation, Inc.
 
 ;; Author: Arash Esbati <arash@gnu.org>
 ;; Maintainer: auctex-devel@gnu.org
@@ -57,7 +57,7 @@
  TeX-dialect)
 
 (defvar LaTeX-cancel-package-options
-  '("thicklines" "samesize" "smaller" "Smaller")
+  '("thicklines" "samesize" "smaller" "Smaller" "makeroom" "overlap")
   "Package options for the cancel package.")
 
 ;;; cancel.el ends here
diff --git a/tests/latex/align-in.tex b/tests/latex/align-in.tex
new file mode 100644
index 00000000..b2c8a99e
--- /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 00000000..b2c8a99e
--- /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 eae951f1..e22d2a08 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 ac0a8aab..211555a8 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 63242e0d..fc10f018 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 cdb62d97..704ef802 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 49723108..9987937a 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)
@@ -3745,6 +3758,7 @@ other entries will enter `plain-TeX-mode'."
                   (memq 'font-latex-verbatim-face face)
                 (eq face 'font-latex-verbatim-face))))))
 
+;; Delete alias predefined in tex-mode.el.
 ;;;###autoload (if (eq (symbol-function 'TeX-mode) 'tex-mode)
 ;;;###autoload     (defalias 'TeX-mode nil))
 (define-derived-mode TeX-mode text-mode "TeX"
@@ -3873,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
 
@@ -5207,12 +5222,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-element
+        former-mode)
     (while (setq entry (pop full-list))
+      (setq fourth-element (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-element)
+              (memq mode fourth-element)
+              ;; 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-element)))
           (push entry out-list)))
     (nreverse out-list)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]