auctex-diffs
[Top][All Lists]
Advanced

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

master 7a347cd3 2/4: Remove compatibility code for Emacs<26


From: Ikumi Keita
Subject: master 7a347cd3 2/4: Remove compatibility code for Emacs<26
Date: Thu, 4 May 2023 11:26:47 -0400 (EDT)

branch: master
commit 7a347cd39464b841c9249d7f31de5b9140f7d7cb
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>

    Remove compatibility code for Emacs<26
    
    * latex.el (latex-flymake, TeX-latex-mode): Support flymake always.
    * style/dinbrief.el (LaTeX-dinbrief-style):
    (LaTeX-dinbrief-env-recipient):
    * style/letter.el (LaTeX-env-recipient):
    Use `indent-relative-first-indent-point' always.
    * tex.el (TeX-PDF-from-DVI): Use `string-or-null-p' for
    `safe-local-variable' property.
    (TeX-add-local-master): Omit call to `hack-local-variables'.
    ,----[ NEWS.26 ]
    | File local and directory local variables are now initialized each
    | time the major mode is set, not just when the file is first visited.
    | These local variables will thus not vanish on setting a major mode.
    `----
---
 latex.el          | 16 ++++------------
 style/dinbrief.el | 52 +++++++++++++++++++++-------------------------------
 style/letter.el   | 13 ++++---------
 tex.el            | 15 ++++++++-------
 4 files changed, 37 insertions(+), 59 deletions(-)

diff --git a/latex.el b/latex.el
index c3b4f8b8..8d95440a 100644
--- a/latex.el
+++ b/latex.el
@@ -1,6 +1,6 @@
 ;;; latex.el --- Support for LaTeX documents.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1991, 1993-2022 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1993-2023 Free Software Foundation, Inc.
 
 ;; Maintainer: auctex-devel@gnu.org
 ;; Keywords: tex
@@ -31,9 +31,7 @@
 (require 'tex)
 (require 'tex-style)
 (require 'tex-ispell)
-(when (<= 26 emacs-major-version)
-  ;; latex-flymake requires Emacs 26.
-  (require 'latex-flymake))
+(require 'latex-flymake)
 (eval-when-compile
   (require 'cl-lib))
 
@@ -45,11 +43,6 @@
 (declare-function turn-off-filladapt-mode "ext:filladapt"
                   nil)
 
-;; This function is reported to be unknown when built
-;; `with-native-compilation':
-(declare-function LaTeX-flymake "latex-flymake"
-                  (report-fn &rest _args))
-
 ;; Silence the compiler for variables:
 (defvar outline-heading-alist)
 (defvar LaTeX-section-list-changed)
@@ -7905,9 +7898,8 @@ of `LaTeX-mode-hook'."
   (if (and (boundp 'filladapt-mode)
            filladapt-mode)
       (turn-off-filladapt-mode))
-  (when (< 25 emacs-major-version)
-    ;; Set up flymake backend, see latex-flymake.el
-    (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t)))
+  ;; Set up flymake backend, see latex-flymake.el
+  (add-hook 'flymake-diagnostic-functions #'LaTeX-flymake nil t))
 
 (TeX-abbrev-mode-setup doctex-mode)
 
diff --git a/style/dinbrief.el b/style/dinbrief.el
index fe8a5e99..c3108466 100644
--- a/style/dinbrief.el
+++ b/style/dinbrief.el
@@ -1,6 +1,6 @@
 ;;; dinbrief.el --- Special code for LaTeX-Style dinbrief.  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1994-2021  Free Software Foundation, Inc.
+;; Copyright (C) 1994-2023  Free Software Foundation, Inc.
 
 ;; Author: Werner Fink <werner@suse.de>
 ;; Maintainer: auctex-devel@gnu.org
@@ -71,28 +71,23 @@
 
 (defun LaTeX-dinbrief-style ()
   "Insert some useful packages for writing german letters."
-  ;; COMPATIBILITY for EMACS<26
-  (let ((func (if (fboundp 'indent-relative-first-indent-point)
-                  #'indent-relative-first-indent-point
-                ;; Stay away from using #' to avoid compiler warning.
-                'indent-relative-maybe)))
-    (save-excursion
-      (goto-char (point-min)) ; insert before \begin{document}
-      (if (re-search-forward ".begin.document." (point-max) t)
-          (beginning-of-line 1))
-      (open-line 2)
-      (funcall func)
-      (LaTeX-dinbrief-insert TeX-esc "usepackage"
-                             LaTeX-optop "latin1,utf8" LaTeX-optcl
-                             TeX-grop "inputenc" TeX-grcl)
-      (newline-and-indent)
-      (LaTeX-dinbrief-insert TeX-esc "usepackage"
-                             LaTeX-optop "T1" LaTeX-optcl
-                             TeX-grop "fontenc" TeX-grcl)
-      (funcall func)
-      (LaTeX-dinbrief-insert TeX-esc "usepackage"
-                             TeX-grop "ngerman" TeX-grcl))
-    (TeX-run-style-hooks "inputenc" "fontenc" "ngerman")))
+  (save-excursion
+    (goto-char (point-min)) ; insert before \begin{document}
+    (if (re-search-forward ".begin.document." (point-max) t)
+        (beginning-of-line 1))
+    (open-line 2)
+    (indent-relative-first-indent-point)
+    (LaTeX-dinbrief-insert TeX-esc "usepackage"
+                           LaTeX-optop "latin1,utf8" LaTeX-optcl
+                           TeX-grop "inputenc" TeX-grcl)
+    (newline-and-indent)
+    (LaTeX-dinbrief-insert TeX-esc "usepackage"
+                           LaTeX-optop "T1" LaTeX-optcl
+                           TeX-grop "fontenc" TeX-grcl)
+    (indent-relative-first-indent-point)
+    (LaTeX-dinbrief-insert TeX-esc "usepackage"
+                           TeX-grop "ngerman" TeX-grcl))
+  (TeX-run-style-hooks "inputenc" "fontenc" "ngerman"))
 
 (defun LaTeX-dinbrief-env-recipient (environment)
   "Insert ENVIRONMENT and prompt for recipient and address."
@@ -108,12 +103,7 @@
         (opening (TeX-read-string "Anrede: "))
         (closing (TeX-read-string "Schluss: "))
         (signature (TeX-read-string "Unterschrift: "))
-        (anlage (TeX-read-string "Anlagen: "))
-        ;; COMPATIBILITY for EMACS<26
-        (func (if (fboundp 'indent-relative-first-indent-point)
-                  #'indent-relative-first-indent-point
-                ;; Stay away from using #' to avoid compiler warning.
-                'indent-relative-maybe)))
+        (anlage (TeX-read-string "Anlagen: ")))
     (if (string= fenster "ja")
         (progn
           (LaTeX-dinbrief-insert TeX-esc "enabledraftstandard")
@@ -201,7 +191,7 @@
                              opening)
                            TeX-grcl "\n")
 
-    (funcall func)
+    (indent-relative-first-indent-point)
     (save-excursion
       (LaTeX-dinbrief-insert "\n" TeX-esc "closing"
                              TeX-grop
@@ -209,7 +199,7 @@
                                  (concat TeX-esc " ")
                                closing)
                              TeX-grcl "\n")
-      (funcall func))))
+      (indent-relative-first-indent-point))))
 
 (defun LaTeX-dinbrief-sender ()
   "Read and write the senders address."
diff --git a/style/letter.el b/style/letter.el
index 5c64c28b..32c938ec 100644
--- a/style/letter.el
+++ b/style/letter.el
@@ -1,6 +1,6 @@
 ;;; letter.el - Special code for letter style.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1993, 2012, 2013, 2014, 2018, 2020 Free Software Foundation, 
Inc.
+;; Copyright (C) 1993-2023 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: auctex-devel@gnu.org
@@ -101,12 +101,7 @@
         (signature (TeX-read-string "Signature: "))
         (opening (TeX-read-string "Opening: "))
         (closing (TeX-read-string "Closing: "))
-        (date (TeX-read-string "Date: " (LaTeX-today)))
-        ;; COMPATIBILITY for EMACS<26
-        (func (if (fboundp 'indent-relative-first-indent-point)
-                  #'indent-relative-first-indent-point
-                ;; Stay away from using #' to avoid compiler warning.
-                'indent-relative-maybe)))
+        (date (TeX-read-string "Date: " (LaTeX-today))))
 
     (insert TeX-esc "name" TeX-grop sender TeX-grcl)
     (newline-and-indent)
@@ -157,7 +152,7 @@
               opening)
             TeX-grcl "\n")
 
-    (funcall func)
+    (indent-relative-first-indent-point)
     (save-excursion
       (insert "\n" TeX-esc "closing"
               TeX-grop
@@ -165,7 +160,7 @@
                   (concat TeX-esc " ")
                 closing)
               TeX-grcl "\n")
-      (funcall func))))
+      (indent-relative-first-indent-point))))
 
 (defun LaTeX-today nil
   "Return a string representing todays date according to flavor."
diff --git a/tex.el b/tex.el
index 6f077f37..b862d3c2 100644
--- a/tex.el
+++ b/tex.el
@@ -2098,12 +2098,11 @@ Programs should not use this variable directly but the 
function
   :type '(choice
           (const :tag "No DVI to PDF conversion" nil)
           (const :tag "dvips - ps2pdf sequence" "Dvips")
-          (const :tag "dvipdfmx" "Dvipdfmx")))
+          (const :tag "dvipdfmx" "Dvipdfmx"))
+  :safe #'string-or-null-p)
 ;; If you plan to support new values of `TeX-PDF-from-DVI' remember to update
 ;; `TeX-command-default' accordingly.
 (make-variable-buffer-local 'TeX-PDF-from-DVI)
-(put 'TeX-PDF-from-DVI 'safe-local-variable
-     (lambda (x) (or (stringp x) (null x))))
 
 (defcustom TeX-PDF-via-dvips-ps2pdf nil
   "Whether to produce PDF output through the (La)TeX - dvips - ps2pdf 
sequence."
@@ -2483,10 +2482,12 @@ Get `major-mode' from master file and enable it."
          comment-prefix "End:\n")
         (unless (eq mode major-mode)
           (funcall mode)
-          ;; TeX modes run `VirTeX-common-initialization' which kills all local
-          ;; variables, thus `TeX-master' will be forgotten after `(funcall
-          ;; mode)'.  Reparse local variables in order to bring it back.
-          (hack-local-variables))))))
+          ;; On Emacs 26 and later, no need to reparse local variables
+          ;; in order to retain `TeX-master' because major mode
+          ;; function runs `hack-local-variables' through
+          ;; `run-mode-hooks'.
+          ;; (hack-local-variables)
+          )))))
 
 (defun TeX-local-master-p ()
   "Return non-nil if there is a `TeX-master' entry in local variables spec.



reply via email to

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