[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 80
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 801b5d466c4badc037aca073b338c930828004b3 |
Date: |
Fri, 11 Sep 2020 09:02:04 -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 801b5d466c4badc037aca073b338c930828004b3 (commit)
from 9e2a8e0b59b578a6b2a980bfc181a73bc0898a12 (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 801b5d466c4badc037aca073b338c930828004b3
Author: Tassilo Horn <tsdh@gnu.org>
Date: Fri Sep 11 14:58:55 2020 +0200
Remove FILE/FILE-FN argument from TeX-command-expand
diff --git a/preview.el.in b/preview.el.in
index c14e490..f1cbb18 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -945,9 +945,9 @@ Pure borderless black-on-white will return an empty string."
(funcall (car gsfile) "dvi" t))))
(file-error nil))
(when preview-ps-file
- (condition-case nil
- (preview-delete-file preview-ps-file)
- (file-error nil)))
+ (condition-case nil
+ (preview-delete-file preview-ps-file)
+ (file-error nil)))
(setq TeX-sentinel-function nil))
(defalias 'preview-dvipng-abort 'preview-dvips-abort)
@@ -3671,8 +3671,7 @@ The fourth value is the transparent border thickness."
(colors (preview-dvipng-color-string preview-colors res))
(command (with-current-buffer TeX-command-buffer
(prog1
- (concat (TeX-command-expand preview-dvipng-command
- (car file))
+ (concat (TeX-command-expand preview-dvipng-command)
" " colors resolution)
(setq tempdir TeX-active-tempdir))))
(name "Preview-DviPNG"))
@@ -3710,8 +3709,7 @@ If FAST is set, do a fast conversion."
(prog1
(TeX-command-expand (if fast
preview-fast-dvips-command
- preview-dvips-command)
- (car file))
+ preview-dvips-command))
(setq tempdir TeX-active-tempdir))))
(name "Preview-DviPS"))
(setq TeX-active-tempdir tempdir)
@@ -3751,8 +3749,7 @@ If FAST is set, do a fast conversion."
pdfsource
(command (with-current-buffer TeX-command-buffer
(prog1
- (TeX-command-expand preview-pdf2dsc-command
- (car file))
+ (TeX-command-expand preview-pdf2dsc-command)
(setq tempdir TeX-active-tempdir
pdfsource (funcall (car file) "pdf" t)))))
(name "Preview-PDF2DSC"))
@@ -3930,8 +3927,7 @@ If FORMAT-CONS is non-nil, a previous format may get
reused."
(master-file (expand-file-name (TeX-master-file t)))
(command (preview-do-replacements
(TeX-command-expand
- (preview-string-expand preview-LaTeX-command)
- 'TeX-master-file)
+ (preview-string-expand preview-LaTeX-command))
preview-dump-replacements))
(preview-auto-cache-preamble nil))
(unless (and (consp (cdr format-cons))
@@ -3952,10 +3948,8 @@ If FORMAT-CONS is non-nil, a previous format may get
reused."
\\def\\AUCTEXINPUT##1{\\catcode`/ 12\\relax\\catcode`\\
9\\relax\\input\\detokenize{##1}\\relax}%
\\let\\dump\\PREVIEWdump\\dump}\\input mylatex.ltx \\relax%\n" nil dump-file)
(TeX-save-document master)
- (prog1
- (preview-generate-preview
- nil master
- command)
+ (setq TeX-current-process-region-p nil)
+ (prog1 (preview-generate-preview master command)
(add-hook 'kill-emacs-hook #'preview-cleanout-tempfiles t)
(setq TeX-sentinel-function
`(lambda (process string)
@@ -4003,11 +3997,11 @@ stored in `preview-dumped-alist'."
(save-excursion
(goto-char begin)
(if (bolp) 0 -1))))))
- (preview-generate-preview t (TeX-region-file)
+ (setq TeX-current-process-region-p t)
+ (preview-generate-preview (TeX-region-file)
(preview-do-replacements
(TeX-command-expand
- (preview-string-expand preview-LaTeX-command)
- 'TeX-region-file)
+ (preview-string-expand preview-LaTeX-command))
preview-LaTeX-command-replacements)))
(defun preview-buffer ()
@@ -4042,12 +4036,12 @@ stored in `preview-dumped-alist'."
"Run preview on master document."
(interactive)
(TeX-save-document (TeX-master-file))
+ (setq TeX-current-process-region-p nil)
(preview-generate-preview
- nil (TeX-master-file)
+ (TeX-master-file)
(preview-do-replacements
(TeX-command-expand
- (preview-string-expand preview-LaTeX-command)
- 'TeX-master-file)
+ (preview-string-expand preview-LaTeX-command))
preview-LaTeX-command-replacements)))
(defun preview-environment (count)
@@ -4080,19 +4074,16 @@ environments is selected."
(preview-region (region-beginning) (region-end))))
-(defun preview-generate-preview (region-p file command)
+(defun preview-generate-preview (file command)
"Generate a preview.
-REGION-P is the region flag, FILE the file (without default
-extension), COMMAND is the command to use.
+FILE the file (without default extension), COMMAND is the command
+to use.
It returns the started process."
- (setq TeX-current-process-region-p region-p)
(let* ((geometry (preview-get-geometry))
(commandbuff (current-buffer))
(pr-file (cons
- (if TeX-current-process-region-p
- 'TeX-region-file
- 'TeX-master-file)
+ 'TeX-active-master
(file-name-nondirectory file)))
(master (TeX-master-file))
(master-file (expand-file-name master))
diff --git a/tests/japanese/preview-latex.el b/tests/japanese/preview-latex.el
index 41907df..5ca3d96 100644
--- a/tests/japanese/preview-latex.el
+++ b/tests/japanese/preview-latex.el
@@ -228,8 +228,7 @@ String encoded in `shift_jis' can have regexp meta
characters in it."
(setq process (TeX-inline-preview-internal
(preview-do-replacements
(TeX-command-expand
- (preview-string-expand preview-LaTeX-command)
- 'TeX-master-file)
+ (preview-string-expand preview-LaTeX-command))
preview-LaTeX-command-replacements)
dummyfile '(nil . nil) (current-buffer)
'(nil . (t . t)) dummyfile '(nil nil nil)))
@@ -263,8 +262,7 @@ String encoded in `shift_jis' can have regexp meta
characters in it."
(setq process (TeX-inline-preview-internal
(preview-do-replacements
(TeX-command-expand
- (preview-string-expand preview-LaTeX-command)
- 'TeX-master-file)
+ (preview-string-expand preview-LaTeX-command))
preview-dump-replacements)
dummyfile '(nil . nil) (current-buffer)
nil dummyfile '(nil nil nil)))
diff --git a/tests/tex/command-expansion.el b/tests/tex/command-expansion.el
index 0de5831..bb5c7d4 100644
--- a/tests/tex/command-expansion.el
+++ b/tests/tex/command-expansion.el
@@ -29,8 +29,7 @@
(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))
+ (TeX-command-expand (nth 1 (assoc "Test" TeX-command-list))))
"%% ")))
(ert-deftest TeX-command-expansion-errors ()
@@ -39,7 +38,7 @@
;; This error is actually thrown by `TeX-engine-in-engine-alist', but we
want
;; to be sure that `TeX-command-expand' fails when the engine is not valid.
(let ((TeX-engine 'non-existing-engine))
- (TeX-command-expand "%l" 'TeX-master-file))))
+ (TeX-command-expand "%l"))))
(ert-deftest TeX-view-command-raw-errors ()
"Tests to trigger errors in `TeX-view-command-raw'."
@@ -94,7 +93,7 @@
(TeX-engine 'default)
(TeX-master "/tmp/abc")
(TeX-command-extra-options " \"\\foo\""))
- (TeX-command-expand "%`%(extraopts)%' %T" #'TeX-master-file))
+ (TeX-command-expand "%`%(extraopts)%' %T"))
" \"\\foo\" \"\\input\" \\\\detokenize\\{\\ abc.tex\\ \\}")))
(ert-deftest TeX-command-expand-skip-file-name ()
@@ -108,24 +107,24 @@ 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-command-expand "%s")
TeX-master))
(should (string=
- (TeX-command-expand "%t" #'TeX-master-file)
+ (TeX-command-expand "%t")
(TeX-master-file "tex" t)))
(should (string=
- (TeX-command-expand "%T" #'TeX-master-file)
+ (TeX-command-expand "%T")
(TeX-master-file "tex" t)))
(should (string=
- (TeX-command-expand "%d" #'TeX-master-file)
+ (TeX-command-expand "%d")
(TeX-master-file "dvi" t)))
(should (string=
- (TeX-command-expand "%f" #'TeX-master-file)
+ (TeX-command-expand "%f")
(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-command-expand "%o")
;; (TeX-master-file "pdf" t)))
))
@@ -138,11 +137,11 @@ See
<https://lists.gnu.org/r/bug-auctex/2014-08/msg00012.html>."
TeX-current-process-region-p)
(setq TeX-current-process-region-p nil)
(should (string=
- (TeX-command-expand "%s" #'TeX-active-master)
+ (TeX-command-expand "%s")
TeX-master))
(setq TeX-current-process-region-p t)
(should (string=
- (TeX-command-expand "%s" #'TeX-active-master)
+ (TeX-command-expand "%s")
TeX-region))))
;;; command-expansion.el ends here
diff --git a/tex-buf.el b/tex-buf.el
index 975c6fc..b9d9085 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 ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list))
- file-fn))
+ (let ((command (TeX-command-expand (nth 1 (assoc name TeX-command-list))))
(hook (nth 2 (assoc name TeX-command-list)))
(confirm (if override-confirm
(> (prefix-numeric-value override-confirm) 0)
@@ -535,8 +534,8 @@ 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-fn &optional list)
- "Expand COMMAND for FILE as described in LIST.
+(defun TeX-command-expand (command &optional list)
+ "Expand COMMAND for `TeX-active-master' 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."
@@ -551,40 +550,32 @@ without further expansion."
"%"))
(or list (TeX-expand-list)))
pat (regexp-opt (mapcar #'car list)))
- ;; `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-fn name involves some special characters such as
- ;; space and multibyte characters. Hence embed that function in a
- ;; template prepared for that purpose.
- (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
- ((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))
+ (let ((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
+ ((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
(&optional extension nondirectory ask extra)
diff --git a/tex.el b/tex.el
index 4719eb4..ce31831 100644
--- a/tex.el
+++ b/tex.el
@@ -1567,11 +1567,11 @@ predicates are true, nil otherwise."
(unless (or (null executable)
(cond
((stringp executable)
- (executable-find (TeX-command-expand executable nil)))
+ (executable-find (TeX-command-expand executable)))
((listp executable)
(catch 'notfound
(dolist (exec executable t)
- (unless (executable-find (TeX-command-expand exec nil))
+ (unless (executable-find (TeX-command-expand exec))
(throw 'notfound nil)))))))
(error (format "Cannot find %S viewer. \
Select another one in `TeX-view-program-selection'" viewer)))
-----------------------------------------------------------------------
Summary of changes:
preview.el.in | 47 ++++++++++++-----------------
tests/japanese/preview-latex.el | 6 ++--
tests/tex/command-expansion.el | 23 +++++++-------
tex-buf.el | 67 ++++++++++++++++++-----------------------
tex.el | 4 +--
5 files changed, 63 insertions(+), 84 deletions(-)
hooks/post-receive
--
GNU AUCTeX
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [AUCTeX-diffs] GNU AUCTeX branch, lexical-binding-attempt-1, updated. 801b5d466c4badc037aca073b338c930828004b3,
Tassilo Horn <=