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. 9e


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 9e2a8e0b59b578a6b2a980bfc181a73bc0898a12
Date: Wed, 9 Sep 2020 12:16:16 -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  9e2a8e0b59b578a6b2a980bfc181a73bc0898a12 (commit)
      from  a88ccc6f3690533239f1646e9ce2826d94f058ed (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 9e2a8e0b59b578a6b2a980bfc181a73bc0898a12
Author: Tassilo Horn <tsdh@gnu.org>
Date:   Wed Sep 9 18:15:52 2020 +0200

    Fix command expansion.
    
    TeX-file-fn is gone.  Use the symbol or function TeX-active-master in
    TeX-expand-list{,-builtin} where formally `file' (and then TeX-file-fn) was
    used.

diff --git a/tex-buf.el b/tex-buf.el
index e600e63..975c6fc 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -494,8 +494,7 @@ been set."
   ;; of point in the region file so that forward search works.
   (if (string= name "View") (TeX-region-update-point))
 
-  (let ((TeX-file-fn file-fn)
-        (command (TeX-command-expand (nth 1 (assoc name TeX-command-list))
+  (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list))
                                     file-fn))
        (hook (nth 2 (assoc name TeX-command-list)))
        (confirm (if override-confirm
@@ -536,7 +535,7 @@ remember to add /Library/TeX/texbin/ to your PATH"
       (TeX-process-set-variable file 'TeX-command-next TeX-command-Show)
       (funcall hook name command file))))
 
-(defun TeX-command-expand (command file &optional list)
+(defun TeX-command-expand (command file-fn &optional list)
   "Expand COMMAND for FILE as described in LIST.
 LIST default to `TeX-expand-list'.  As a special exception,
 `%%' can be used to produce a single `%' sign in the output
@@ -552,64 +551,56 @@ without further expansion."
                             "%"))
                (or list (TeX-expand-list)))
          pat (regexp-opt (mapcar #'car list)))
-    ;; `TeX-command-expand' is called with `file' argument being one
+    ;; `TeX-command-expand' is called with `file-fn' argument being one
     ;; of `TeX-master-file', `TeX-region-file' and
     ;; `TeX-active-master'.  The return value of these functions
     ;; sometimes needs suitable "decorations" for an argument for
     ;; underlying shell or latex executable, or both, when the
-    ;; relavant file name involves some special characters such as
+    ;; relavant file-fn name involves some special characters such as
     ;; space and multibyte characters.  Hence embed that function in a
     ;; template prepared for that purpose.
-    (setq TeX-file-fn (apply-partially
-                      #'TeX--master-or-region-file-with-extra-quotes
-                      file))
+    (setq file-fn #'TeX--master-or-region-file-with-extra-quotes)
     (while (setq TeX-expand-pos (string-match pat TeX-expand-command 
TeX-expand-pos))
       (setq string (match-string 0 TeX-expand-command)
            entry (assoc string list)
            expansion (car (cdr entry)) ;Second element
            arguments (cdr (cdr entry)) ;Remaining elements
            string (save-match-data
-                    (cond ((functionp expansion)
-                            (apply expansion arguments))
-                          ((boundp expansion)
-                            (let ((res (apply (symbol-value expansion) 
arguments)))
-                              ;; Advance past the file name in order to
-                              ;; prevent expanding any substring of it.
-                              (when (eq expansion 'TeX-file-fn)
-                                (setq TeX-expand-pos
-                                      (+ TeX-expand-pos (length res))))
-                              res))
-                          (t
-                           (error "Nonexpansion %s" expansion)))))
+                    (cond
+                      ((memq expansion (list 'TeX-active-master
+                                             #'TeX-active-master))
+                       (let ((res (apply file-fn arguments)))
+                         ;; Advance past the file name in order to
+                         ;; prevent expanding any substring of it.
+                         (setq TeX-expand-pos
+                               (+ TeX-expand-pos (length res)))
+                         res))
+                      ((functionp expansion)
+                       (apply expansion arguments))
+                     ((boundp expansion)
+                       (apply (symbol-value expansion) arguments))
+                     (t
+                      (error "Nonexpansion %s" expansion)))))
       (if (stringp string)
          (setq TeX-expand-command
                (replace-match string t t TeX-expand-command))))
     TeX-expand-command))
 
 (defun TeX--master-or-region-file-with-extra-quotes
-    (file-fn &optional extension nondirectory ask extra)
-  "Return file name with quote for shell.
-Helper function of `TeX-command-expand'.
-
-This is a kind of template.  How to use:
-Fix, by `apply-partially', the first argument FILE-FN as one of
-the three functions `TeX-master-file', `TeX-region-file' or
-`TeX-active-master'.  Then the result is just a wrapper for that
-function suitable in `TeX-command-expand'.
-
-As a wrapper described above, it passes EXTENSION, NONDIRECTORY
-and ASK to the \"bare\" function as-is, and arranges the returned
-file name for use with command shell.  I.e. it encloses the file
-name with space within quotes `\"' first when \" \\input\" is
-supplemented (indicated by dynamically binded variable
-`TeX-command-text' having string value.)  It also encloses the
-file name within \\detokenize{} when the following three
-conditions are met:
-1. compiling with standard (pdf)LaTeX or upLaTeX
-2. \" \\input\" is supplemented
-3. EXTRA is non-nil (default when expanding \"%T\")"
+    (&optional extension nondirectory ask extra)
+  "Return the current master or region file name with quote for shell.
+I.e. it encloses the file name with space within quotes `\"'
+first when \" \\input\" is supplemented (indicated by dynamically
+binded variable `TeX-command-text' having string value.)  It also
+encloses the file name within \\detokenize{} when the following
+three conditions are met:
+  1. compiling with standard (pdf)LaTeX or upLaTeX
+  2. \" \\input\" is supplemented
+  3. EXTRA is non-nil (default when expanding \"%T\")
+
+Helper function of `TeX-command-expand'."
   (shell-quote-argument
-   (let* ((raw (funcall file-fn extension nondirectory ask))
+   (let* ((raw (funcall #'TeX-active-master extension nondirectory ask))
          ;; String `TeX-command-text' means that the file name is
          ;; given through \input command.
          (quote-for-space (if (and (stringp TeX-command-text)
diff --git a/tex.el b/tex.el
index 2664096..4719eb4 100644
--- a/tex.el
+++ b/tex.el
@@ -511,11 +511,6 @@ string."
   :type 'string)
 (make-variable-buffer-local 'TeX-command-extra-options)
 
-(defvar TeX-file-fn nil
-  "Dynamically bound by `TeX-command'.
-Usually, either `TeX-master-file', `TeX-region-file', or
-`TeX-active-master'.")
-
 (defvar TeX-command-text nil
   "Dynamically bound by `TeX-command-expand'.")
 (defvar TeX-command-pos nil
@@ -595,10 +590,10 @@ Usually, either `TeX-master-file', `TeX-region-file', or
                    (or (if TeX-source-correlate-output-page-function
                            (funcall TeX-source-correlate-output-page-function))
                        "1")))
-    ;; `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)
+    ;; `TeX-active-master' calls either calls`TeX-master-file' or
+    ;; `TeX-region-file' returning the master or region file.
+    ("%s" TeX-active-master nil t)
+    ("%t" TeX-active-master 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'
@@ -645,11 +640,11 @@ Usually, either `TeX-master-file', `TeX-region-file', or
     ;; provided by `TeX--master-or-region-file-with-extra-quotes'.
     ;; See its doc string as well as the comments in
     ;; `TeX-command-expand'.
-    ("%T" TeX-file-fn t t nil t)
+    ("%T" TeX-active-master t t nil t)
     ("%n" TeX-current-line)
-    ("%d" TeX-file-fn "dvi" t)
-    ("%f" TeX-file-fn "ps" t)
-    ("%o" (lambda nil (funcall TeX-file-fn (TeX-output-extension) t)))
+    ("%d" TeX-active-master "dvi" t)
+    ("%f" TeX-active-master "ps" t)
+    ("%o" (lambda nil (TeX-active-master (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
@@ -5095,10 +5090,9 @@ 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 ((TeX-file-fn 'TeX-command-on-current)) ;; is this actually needed?
-     (delq nil
-          (mapcar #'TeX-command-menu-entry
-                  (TeX-mode-specific-command-list mode))))))
+   (delq nil
+        (mapcar #'TeX-command-menu-entry
+                (TeX-mode-specific-command-list mode)))))
 
 (defun TeX-mode-specific-command-list (mode)
   "Return the list of commands available in the given MODE."

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

Summary of changes:
 tex-buf.el | 75 +++++++++++++++++++++++++++-----------------------------------
 tex.el     | 28 +++++++++--------------
 2 files changed, 44 insertions(+), 59 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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