auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 48160922debb8958a51b4


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 48160922debb8958a51b47fd30aef6afcf55d709
Date: Thu, 5 Jul 2018 13:53:30 -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, master has been updated
       via  48160922debb8958a51b47fd30aef6afcf55d709 (commit)
      from  a59c754a2f9c92f78325d7a6e39e5c04c64a098b (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 48160922debb8958a51b47fd30aef6afcf55d709
Author: Ikumi Keita <address@hidden>
Date:   Fri Jul 6 02:20:33 2018 +0900

    Fix possible endless loop
    
    * tex.el (TeX-expand-list-builtin): Use symbol `file' for the entry
    "%T" so that special treatment for `file' about advancing matching
    position in `TeX-command-expand' takes effect.
    * tests/tex/command-expansion.el (TeX-command-expand-skip-file-name):
    New test.

diff --git a/tests/tex/command-expansion.el b/tests/tex/command-expansion.el
index 9215a32..14e425d 100644
--- a/tests/tex/command-expansion.el
+++ b/tests/tex/command-expansion.el
@@ -97,4 +97,33 @@
             (TeX-command-expand "%`%(extraopts)%' %T" #'TeX-master-file))
           " \"\\foo\" \"\\input\" \\\\detokenize\\{\\ abc.tex\\ \\}")))
 
+(ert-deftest TeX-command-expand-skip-file-name ()
+  "Check whether file name is not subject to further expansion.
+File names obtained as expansion of \"%t\", \"%s\" and so on should be
+skipped for the following expansion to avoid possible endless loop.
+See <https://lists.gnu.org/r/bug-auctex/2014-08/msg00012.html>."
+  (let ((TeX-master "abc-def")
+       (TeX-expand-list '(("-" (lambda () ":")))))
+    (should (string=
+            (TeX-command-expand "%s" #'TeX-master-file)
+            TeX-master))
+    (should (string=
+            (TeX-command-expand "%t" #'TeX-master-file)
+            (TeX-master-file "tex" t)))
+    (should (string=
+            (TeX-command-expand "%T" #'TeX-master-file)
+            (TeX-master-file "tex" t)))
+    (should (string=
+            (TeX-command-expand "%d" #'TeX-master-file)
+            (TeX-master-file "dvi" t)))
+    (should (string=
+            (TeX-command-expand "%f" #'TeX-master-file)
+            (TeX-master-file "ps" t)))
+    ;; The expander of "%o" does not yet cater for this possible endless
+    ;; loop.
+    ;; (should (string=
+    ;;              (TeX-command-expand "%o" #'TeX-master-file)
+    ;;              (TeX-master-file "pdf" t)))
+    ))
+
 ;;; command-expansion.el ends here
diff --git a/tex.el b/tex.el
index 63ae293..68a7942 100644
--- a/tex.el
+++ b/tex.el
@@ -540,7 +540,10 @@ string."
                  (setq pos (+ pos (length TeX-command-text) 9))
                  (concat TeX-command-text " \"\\input\""))
              "")))
-    ("%T" TeX--master-or-region-file-with-extra-quotes t t nil t)
+    ;; The fourth argument of t is actually for wrapper function
+    ;; `TeX--master-or-region-file-with-extra-quotes', temporally set
+    ;; as value of `file' in `TeX-command-expand'.
+    ("%T" file t t nil t)
     ("%n" TeX-current-line)
     ("%d" file "dvi" t)
     ("%f" file "ps" t)

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

Summary of changes:
 tests/tex/command-expansion.el | 29 +++++++++++++++++++++++++++++
 tex.el                         |  5 ++++-
 2 files changed, 33 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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