auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. ef


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. ef6418d4dce589a63f66851e741e267d9f3b0693
Date: Fri, 4 Sep 2020 16:43:35 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, lexical-binding-attempt-1 has been updated
       via  ef6418d4dce589a63f66851e741e267d9f3b0693 (commit)
      from  13207c40dd16eb8628c91cad6db106c1469653e1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ef6418d4dce589a63f66851e741e267d9f3b0693
Author: Tassilo Horn <tsdh@gnu.org>
Date:   Fri Sep 4 22:42:42 2020 +0200

    Enable lexical-binding in tex.el; convert dynamically bound `file' var

diff --git a/tex-buf.el b/tex-buf.el
index 510722c..b43b77d 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1,4 +1,4 @@
-;;; tex-buf.el --- External commands for AUCTeX.
+;;; tex-buf.el --- External commands for AUCTeX.  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1991-1999, 2001-2020 Free Software Foundation, Inc.
 
@@ -494,7 +494,9 @@ been set."
   ;; of point in the region file so that forward search works.
   (if (string= name "View") (TeX-region-update-point))
 
-  (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list))
+  (let ((TeX-file-fn file)
+        (TeX-file (when (functionp file) (funcall file)))
+        (command (TeX-command-expand (nth 1 (assoc name TeX-command-list))
                                     file))
        (hook (nth 2 (assoc name TeX-command-list)))
        (confirm (if override-confirm
@@ -531,9 +533,8 @@ remember to add /Library/TeX/texbin/ to your PATH"
                          ""))))
 
     ;; Now start the process
-    (setq file (funcall file))
-    (TeX-process-set-variable file 'TeX-command-next TeX-command-Show)
-    (funcall hook name command file)))
+    (TeX-process-set-variable TeX-file 'TeX-command-next TeX-command-Show)
+    (funcall hook name command TeX-file)))
 
 (defvar TeX-command-text)               ;Dynamically scoped.
 (defvar TeX-command-pos)                ;Dynamically scoped.
@@ -562,9 +563,9 @@ without further expansion."
     ;; relavant file name involves some special characters such as
     ;; space and multibyte characters.  Hence embed that function in a
     ;; template prepared for that purpose.
-    (setq file (apply-partially
-               #'TeX--master-or-region-file-with-extra-quotes
-               file))
+    (setq TeX-file-fn (apply-partially
+                      #'TeX--master-or-region-file-with-extra-quotes
+                      file))
     (while (setq pos (string-match pat command pos))
       (setq string (match-string 0 command)
            entry (assoc string list)
@@ -2475,6 +2476,7 @@ If REPARSE is non-nil, reparse the output log.
 If the file occurs in an included file, the file is loaded (if not
 already in an Emacs buffer) and the cursor is placed at the error."
   (let ((old-buffer (current-buffer))
+        ;; FIXME: default-major-mode has been removed in Emacs 26.
        (default-major-mode major-mode)
        max-index item)
 
@@ -3546,6 +3548,7 @@ please restart TeX error overview")))
          (with-current-buffer TeX-command-buffer
            ;; For consistency with `TeX-parse-TeX', use the major mode of
            ;; `TeX-command-buffer' when visiting the error point.
+            ;; FIXME: default-major-mode has been removed in Emacs 26.
            (let ((default-major-mode major-mode))
              ;; Find the error and display the help.
              (apply #'TeX-find-display-help item)))
diff --git a/tex.el b/tex.el
index b2bbbbf..97af769 100644
--- a/tex.el
+++ b/tex.el
@@ -1,4 +1,4 @@
-;;; tex.el --- Support for TeX documents.
+;;; tex.el --- Support for TeX documents.  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 1985-2020 Free Software Foundation, Inc.
 
@@ -515,6 +515,14 @@ string."
 ;; TeX-command-list.  Not likely to be changed, but you may e.g. want
 ;; to handle .ps files.
 
+(defvar TeX-file-fn nil
+  "Dynamically bound by `TeX-command'.
+Usually, either `TeX-master-file', `TeX-region-file', or
+`TeX-active-master'.")
+(defvar TeX-file nil
+  "Dynamically bound by `TeX-command'.
+Result of funcalling `TeX-file-fn'.")
+
 (defvar TeX-expand-list-builtin
   '(("%q" (lambda ()
            (TeX-printer-query t)))
@@ -581,9 +589,10 @@ string."
                    (or (if TeX-source-correlate-output-page-function
                            (funcall TeX-source-correlate-output-page-function))
                        "1")))
-    ;; `file' means to call `TeX-master-file', `TeX-region-file' or 
`TeX-active-master'
-    ("%s" file nil t)
-    ("%t" file t t)
+    ;; `TeX-file-fn' means to call `TeX-master-file', `TeX-region-file' or
+    ;; `TeX-active-master'.
+    ("%s" TeX-file-fn nil t)
+    ("%t" TeX-file-fn t t)
     ;; If any TeX codes appear in the interval between %` and %', move
     ;; all of them after the interval and supplement " \input".  The
     ;; appearance is marked by leaving the bind to `TeX-command-text'
@@ -630,11 +639,11 @@ string."
     ;; provided by `TeX--master-or-region-file-with-extra-quotes'.
     ;; See its doc string as well as the comments in
     ;; `TeX-command-expand'.
-    ("%T" file t t nil t)
+    ("%T" TeX-file-fn t t nil t)
     ("%n" TeX-current-line)
-    ("%d" file "dvi" t)
-    ("%f" file "ps" t)
-    ("%o" (lambda nil (funcall file (TeX-output-extension) t)))
+    ("%d" TeX-file-fn "dvi" t)
+    ("%f" TeX-file-fn "ps" t)
+    ("%o" (lambda nil (funcall TeX-file-fn (TeX-output-extension) t)))
     ;; for source specials the file name generated for the xdvi
     ;; command needs to be relative to the master file, just in
     ;; case the file is in a different subdirectory
@@ -1237,7 +1246,7 @@ entry in `TeX-view-program-list-builtin'."
                                 (get-file-buffer (TeX-region-file t)))
                               (current-buffer))
        (pdf-sync-forward-search))
-    (let ((pdf (concat file "." (TeX-output-extension))))
+    (let ((pdf (concat TeX-file "." (TeX-output-extension))))
       (pop-to-buffer (or (find-buffer-visiting pdf)
                         (find-file-noselect pdf))))))
 
@@ -1259,9 +1268,10 @@ for the Evince-compatible entries in
 DE is the name of the desktop environment, APP is the name of
 viewer."
   (require 'url-util)
-  (let* ((uri (concat "file://" (url-encode-url
-                                (expand-file-name
-                                 (concat file "." (TeX-output-extension))))))
+  (let* ((uri (concat "file://"
+                      (url-encode-url
+                      (expand-file-name
+                       (concat TeX-file "." (TeX-output-extension))))))
         (owner (dbus-call-method
                 :session (format "org.%s.%s.Daemon" de app)
                 (format "/org/%s/%s/Daemon" de app)
@@ -3122,7 +3132,6 @@ Possible values are nil, t, or a list of style names.
 
 (defmacro TeX-complete-make-expert-command-functions (thing list-var prefix)
   (let* ((plural (concat thing "s"))
-        (upcase (upcase thing))
         (upcase-plural (upcase plural)))
     `(progn
        (defvar ,(intern (format "%s-expert-%s-table" prefix thing))
@@ -3949,7 +3958,7 @@ Generated by `TeX-auto-add-type'.")
 
 (defun TeX-safe-auto-write ()
   "Call `TeX-auto-write' safely."
-  (condition-case name
+  (condition-case _ignored
       (and (boundp 'TeX-auto-update)
           TeX-auto-update
           (TeX-auto-write))
@@ -3981,7 +3990,7 @@ Generated by `TeX-auto-add-type'.")
             (dir (file-name-directory file)))
        ;; Create auto directory if possible.
        (if (not (file-exists-p dir))
-           (condition-case name
+           (condition-case _ignored
                (make-directory dir)
              (error nil)))
        (if (file-writable-p file)
@@ -4301,7 +4310,7 @@ you should not use something like `[\\(]' for a character 
range."
        (goto-char (if end (min end (point-max)) (point-max)))
        (while (re-search-backward regexp beg t)
          (let* ((entry (cdr (TeX-member nil groups
-                                        (lambda (a b)
+                                        (lambda (_a b)
                                           (match-beginning (car b))))))
                 (symbol (nth 2 entry))
                 (match (nth 1 entry)))
@@ -5073,7 +5082,7 @@ Brace insertion is only done if point is in a math 
construct and
        :help "Make \"Next Error\" show warnings"])
      ["Compile and view" TeX-command-run-all
       :help "Compile the document until it is ready and open the viewer"])
-   (let ((file 'TeX-command-on-current)) ;; is this actually needed?
+   (let ((TeX-file-fn 'TeX-command-on-current)) ;; is this actually needed?
      (delq nil
           (mapcar #'TeX-command-menu-entry
                   (TeX-mode-specific-command-list mode))))))
@@ -5181,7 +5190,7 @@ Brace insertion is only done if point is in a math 
construct and
 (make-variable-buffer-local 'TeX-verbatim-p-function)
 
 ;; XXX: We only have an implementation for LaTeX mode at the moment (Oct 2009).
-(defun TeX-verbatim-p (&optional pos)
+(defun TeX-verbatim-p (&optional _pos)
   "Return non-nil if position POS is in a verbatim-like construct.
 A mode-specific implementation is required.  If it is not
 available, the function always returns nil."
@@ -5289,7 +5298,7 @@ not move point further than this value."
   ;; A value of 0 is nonsense.
   (when (= count 0) (setq count 1))
   (unless limit (setq limit (point-max)))
-  (dotimes (i (abs count))
+  (dotimes (_ (abs count))
     (if (< count 0)
        (forward-line -1)
       (beginning-of-line))
@@ -6225,7 +6234,7 @@ available from ")
         "https://www.gnu.org/software/auctex/";
         'face 'link
         'help-echo (concat "mouse-2, RET: Follow this link")
-        'action (lambda (button)
+        'action (lambda (_button)
                   (browse-url "https://www.gnu.org/software/auctex/";))
         'follow-link t)
        (insert " if your
@@ -6241,7 +6250,7 @@ tracker.  Visit ")
         "https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=auctex";
         'face 'link
         'help-echo (concat "mouse-2, RET: Follow this link")
-        'action (lambda (button)
+        'action (lambda (_button)
                   (browse-url 
"https://debbugs.gnu.org/cgi/pkgreport.cgi?pkg=auctex";))
         'follow-link t)
        (insert "\nto browse existing AUCTeX bugs.
@@ -6410,7 +6419,7 @@ NAME may be a package, a command, or a document."
       (when (and (called-interactively-p 'any)
                 (or (not name) (string= name "")))
        (let ((symbol (thing-at-point 'symbol))
-             contained completions doc)
+             contained completions)
          ;; Is the symbol at point contained in the lists of available
          ;; documentation?
          (setq contained (catch 'found
@@ -6451,7 +6460,7 @@ NAME may be a package, a command, or a document."
 ;; The FSF ispell.el might one day use this.
 (setq ispell-enable-tex-parser t)
 
-(defun TeX-run-ispell (command string file)
+(defun TeX-run-ispell (_command _string file)
   "Run ispell on current TeX buffer."
   (cond ((and (string-equal file (TeX-region-file))
              (fboundp 'ispell-region))
@@ -6471,8 +6480,7 @@ NAME may be a package, a command, or a document."
   (if (string-equal name "")
       (setq name (TeX-master-file)))
 
-  (let ((found nil)
-       (regexp (concat "\\`\\("
+  (let ((regexp (concat "\\`\\("
                        (mapconcat (lambda (dir)
                                     (regexp-quote
                                      (expand-file-name
@@ -6493,10 +6501,9 @@ NAME may be a package, a command, or a document."
       (let* ((buffer (car buffers))
             (name (buffer-file-name buffer)))
        (setq buffers (cdr buffers))
-       (if (and name (string-match regexp name))
-           (progn
-             (save-excursion (switch-to-buffer buffer) (ispell-buffer))
-             (setq found t)))))))
+       (when (and name (string-match regexp name))
+         (save-excursion (switch-to-buffer buffer) (ispell-buffer))
+          t)))))
 
 ;; Some versions of ispell 3 use this.
 (defvar ispell-tex-major-modes nil)

-----------------------------------------------------------------------

Summary of changes:
 tex-buf.el | 19 ++++++++++--------
 tex.el     | 65 ++++++++++++++++++++++++++++++++++----------------------------
 2 files changed, 47 insertions(+), 37 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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