branch: externals/auctex
commit ff688b98e8837387ca5a22f8ff2d57f8bf8fffcd
Author: Ikumi Keita <[email protected]>
Commit: Ikumi Keita <[email protected]>
Stop depreciated usage of undeclared dynamic variable
* tex-buf.el (TeX--master-or-region-file-with-extra-quotes): Redefine
as template. On accepting one of `TeX-master-file', `TeX-region-file'
or `TeX-active-master' as its first argument, it becomes a wrapper for
those three, like previous definition.
(TeX-command-expand): Arrage in accord with the above change.
With these two changes, we no longer need implicit dynamic binding of
non-special variable `orig-file'.
* tex.el (TeX-expand-list-builtin): Update supplementary comment for
"%T".
---
tex-buf.el | 53 +++++++++++++++++++++++++++++++++++++----------------
tex.el | 5 +++--
2 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/tex-buf.el b/tex-buf.el
index e89df51..0849198 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1,6 +1,6 @@
;;; tex-buf.el --- External commands for AUCTeX.
-;; Copyright (C) 1991-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1999, 2001-2019 Free Software Foundation, Inc.
;; Maintainer: [email protected]
;; Keywords: tex, wp
@@ -547,8 +547,6 @@ without further expansion."
(let (pat
pos ;;FIXME: Should this be dynamically scoped?
entry TeX-command-text TeX-command-pos
- (orig-file file)
- (file #'TeX--master-or-region-file-with-extra-quotes)
expansion-res case-fold-search string expansion arguments)
(setq list (cons
(list "%%" (lambda nil
@@ -572,6 +570,24 @@ without further expansion."
(functionp expansion))
(apply expansion arguments))
((boundp expansion)
+ (if (eq expansion 'file)
+ ;; `TeX-command-expand' is called with
+ ;; `file' 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 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 expansion-res
(apply (symbol-value expansion) arguments))
(when (eq expansion 'file)
@@ -587,24 +603,29 @@ without further expansion."
command)
(defun TeX--master-or-region-file-with-extra-quotes
- (&optional extension nondirectory ask extra)
+ (file-fn &optional extension nondirectory ask extra)
"Return file name with quote for shell.
-Wrapper for `TeX-master-file', `TeX-region-file' or
-`TeX-active-master' to be used in `TeX-command-expand'.
-It is assumed that `orig-file' has dynamic binding of the value
-of `TeX-master-file', `TeX-region-file' or `TeX-active-master'.
-Pass EXTENSION, NONDIRECTORY and ASK to that function as-is, and
-arrange the returned file name for use with command shell.
-Enclose the file name with space within quotes `\"' first when
-\" \\input\" is supplemented (indicated by dynamically binded
-variable `TeX-command-text' having string value.)
-Enclose the file name within \\detokenize{} when the following three
+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\")"
+3. EXTRA is non-nil (default when expanding \"%T\")"
(shell-quote-argument
- (let* ((raw (funcall orig-file extension nondirectory ask))
+ (let* ((raw (funcall file-fn 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 684b6f7..0fda0d5 100644
--- a/tex.el
+++ b/tex.el
@@ -555,8 +555,9 @@ string."
(concat TeX-command-text " \"\\input\""))
"")))
;; 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'.
+ ;; 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)
("%n" TeX-current-line)
("%d" file "dvi" t)