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. 49


From: Tassilo Horn
Subject: [AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 49e0416a4bfe16b8f3a1023b6a15e044ca78fe6c
Date: Sun, 6 Sep 2020 04:43:44 -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  49e0416a4bfe16b8f3a1023b6a15e044ca78fe6c (commit)
      from  da14207f1dfb20327aedb58dee0753b9f684ea74 (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 49e0416a4bfe16b8f3a1023b6a15e044ca78fe6c
Author: Tassilo Horn <tsdh@gnu.org>
Date:   Sun Sep 6 10:42:51 2020 +0200

    pos/command during command expansion => TeX-expand-{pos,command}

diff --git a/tex-buf.el b/tex-buf.el
index 54671ef..2a9bad2 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -536,22 +536,19 @@ 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))))
 
-(defvar TeX-command-text)               ;Dynamically scoped.
-(defvar TeX-command-pos)                ;Dynamically scoped.
-
 (defun TeX-command-expand (command file &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
 without further expansion."
-  (defvar TeX-command-pos)
-  (let (pat
-       pos ;;FIXME: Should this be dynamically scoped?
-       entry TeX-command-text TeX-command-pos
-        expansion-res case-fold-search string expansion arguments)
+  (let ((TeX-expand-command command)
+        TeX-expand-pos
+        TeX-command-text
+        TeX-command-pos
+       pat entry expansion-res case-fold-search string expansion arguments)
     (setq list (cons
                (list "%%" (lambda nil
-                            (setq pos (1+ pos))
+                            (setq TeX-expand-pos (1+ TeX-expand-pos))
                             "%"))
                (or list (TeX-expand-list)))
          pat (regexp-opt (mapcar #'car list)))
@@ -566,8 +563,8 @@ without further expansion."
     (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)
+    (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
@@ -587,14 +584,14 @@ without further expansion."
                             (when (eq expansion 'file)
                               ;; Advance past the file name in order to
                               ;; prevent expanding any substring of it.
-                              (setq pos (+ pos (length expansion-res))))
+                              (setq TeX-expand-pos (+ TeX-expand-pos (length 
expansion-res))))
                            expansion-res)
                           (t
                            (error "Nonexpansion %s" expansion)))))
       (if (stringp string)
-         (setq command
-               (replace-match string t t command)))))
-  command)
+         (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)
diff --git a/tex.el b/tex.el
index 41e4150..2664096 100644
--- a/tex.el
+++ b/tex.el
@@ -511,15 +511,24 @@ string."
   :type 'string)
 (make-variable-buffer-local 'TeX-command-extra-options)
 
-;; This is the list of expansion for the commands in
-;; 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-command-text nil
+  "Dynamically bound by `TeX-command-expand'.")
+(defvar TeX-command-pos nil
+  "Dynamically bound by `TeX-command-expand'.")
+(defvar TeX-expand-pos nil
+  "Dynamically bound by `TeX-command-expand'.")
+(defvar TeX-expand-command nil
+  "Dynamically bound by `TeX-command-expand'.")
+
+;; This is the list of expansion for the commands in
+;; TeX-command-list.  Not likely to be changed, but you may e.g. want
+;; to handle .ps files.
+
 (defvar TeX-expand-list-builtin
   '(("%q" (lambda ()
            (TeX-printer-query t)))
@@ -605,31 +614,31 @@ Usually, either `TeX-master-file', `TeX-region-file', or
            ""))
     (" \"\\" (lambda nil
               (if (eq TeX-command-pos t)
-                  (setq TeX-command-pos pos
-                        pos (+ 3 pos))
-                (setq pos (1+ pos)))))
+                  (setq TeX-command-pos TeX-expand-pos
+                        TeX-expand-pos (+ 3 TeX-expand-pos))
+                (setq TeX-expand-pos (1+ TeX-expand-pos)))))
     ("\"" (lambda nil (if (numberp TeX-command-pos)
                          (setq TeX-command-text
                                (concat
                                 TeX-command-text
-                                (substring command
+                                (substring TeX-expand-command
                                            TeX-command-pos
-                                           (1+ pos)))
-                               command
+                                           (1+ TeX-expand-pos)))
+                               TeX-expand-command
                                (concat
-                                (substring command
+                                (substring TeX-expand-command
                                            0
                                            TeX-command-pos)
-                                (substring command
-                                           (1+ pos)))
-                               pos TeX-command-pos
+                                (substring TeX-expand-command
+                                           (1+ TeX-expand-pos)))
+                               TeX-expand-pos TeX-command-pos
                                TeX-command-pos t)
-                       (setq pos (1+ pos)))))
+                       (setq TeX-expand-pos (1+ TeX-expand-pos)))))
     ("%'" (lambda nil
            (setq TeX-command-pos nil)
            (if (stringp TeX-command-text)
                (progn
-                 (setq pos (+ pos (length TeX-command-text) 9))
+                 (setq TeX-expand-pos (+ TeX-expand-pos (length 
TeX-command-text) 9))
                  (concat TeX-command-text " \"\\input\""))
              "")))
     ;; The fourth argument of t is actually for wrapper function

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

Summary of changes:
 tex-buf.el | 27 ++++++++++++---------------
 tex.el     | 41 +++++++++++++++++++++++++----------------
 2 files changed, 37 insertions(+), 31 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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