branch: externals/auctex
commit fd46872350fadc2fd5d89615b6ab6bc028f0fa6c
Merge: f351ed9 3ac5929
Author: Tassilo Horn <[email protected]>
Commit: Tassilo Horn <[email protected]>
Merge branch 'master' into simplify-TeX-parse-error
---
ChangeLog | 15 +++++++++++++++
tests/tex/command-expansion.el | 36 ++++++++++++++++++++++++++++++++++++
tex-buf.el | 10 ++++++++--
tex.el | 2 +-
4 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ef147f7..01ff6dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-08-25 Florent Rougon <[email protected]> (tiny change)
+
+ * tex-buf.el (TeX-command-expand): Fix possible endless loop in
+ file name expansion.
+
+2014-08-24 Mos� Giordano <[email protected]>
+
+ * tests/tex/command-expansion.el: New test file.
+
+2014-08-24 Florent Rougon <[email protected]> (tiny change)
+
+ * tex.el (TeX-expand-list): Add the previous position to the
+ lenght of the expanded string to get the current position in the
+ %' expander.
+
2014-08-18 Vincent Bela�che <[email protected]>
* font-latex.el (font-latex-add-quotes): Code optimization: use
diff --git a/tests/tex/command-expansion.el b/tests/tex/command-expansion.el
new file mode 100644
index 0000000..d6dfc89
--- /dev/null
+++ b/tests/tex/command-expansion.el
@@ -0,0 +1,36 @@
+;;; command-expansion.el --- tests for TeX command expansion
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Code:
+
+(require 'ert)
+(require 'tex-buf)
+
+(ert-deftest TeX-command-expansion ()
+ "Check whether \"%%%%\" is correctly expanded when before \"%`\"."
+ (should (string=
+ (let ((TeX-command-list
+ (list (cons "Test" '("%%%% %`%'" TeX-run-command t t)))))
+ (TeX-command-expand (nth 1 (assoc "Test" TeX-command-list))
+ 'TeX-master-file))
+ "%% \"\input\"")))
+
+;;; command-expansion.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index a466446..6eec2b7 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -387,7 +387,7 @@ without further expansion."
(concat (and (stringp TeX-command-pos) TeX-command-pos)
(apply ',file args)
(and (stringp TeX-command-pos) TeX-command-pos)))))
- case-fold-search string expansion arguments)
+ expansion-res case-fold-search string expansion arguments)
(setq list (cons
(list "%%" (lambda nil
(setq pos (1+ pos))
@@ -410,7 +410,13 @@ without further expansion."
(TeX-function-p expansion))
(apply expansion arguments))
((boundp expansion)
- (apply (eval expansion) arguments))
+ (setq expansion-res
+ (apply (eval expansion) arguments))
+ (when (eq expansion 'file)
+ ;; Advance past the file name in order to
+ ;; prevent expanding any substring of it.
+ (setq pos (+ pos (length expansion-res))))
+ expansion-res)
(t
(error "Nonexpansion %s" expansion)))))
(if (stringp string)
diff --git a/tex.el b/tex.el
index e5378aa..cf56f90 100644
--- a/tex.el
+++ b/tex.el
@@ -507,7 +507,7 @@ string."
(prog1
(if (stringp TeX-command-text)
(progn
- (setq pos (+ (length TeX-command-text) 9)
+ (setq pos (+ pos (length TeX-command-text) 9)
TeX-command-pos
(and (string-match " "
(funcall file t t))
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel