[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex c3cf39e 34/48: Make preamble caching robust to L
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex c3cf39e 34/48: Make preamble caching robust to LuaLaTeX and (u)pLaTeX |
Date: |
Sun, 16 Sep 2018 01:47:25 -0400 (EDT) |
branch: externals/auctex
commit c3cf39e2c7b79c5e7de8966ad55dfedc490cec1b
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
Make preamble caching robust to LuaLaTeX and (u)pLaTeX
* preview.el.in (preview-cache-preamble): Modify .ini code so that
LaTeX variants even without \pdfoutput can read unusual file names
(with space or non-ascii character, or both) when preamble cache is
enabled. The modified .ini code is kindly provided by jfbu
<address@hidden>.
(preview-dump-replacements, preview-undump-replacements): Add
-file-line-error option to the undump- variable so that AUCTeX can
analyse the output from lualatex even with file name with space.
It turned out that -kanji option is needed for platex even when
dumping format file if the preamble contains Japanese characters.
Thus modify the both variables so that -kanji option, if any, is
retained.
(TeX-inline-preview-internal): Revert the additional post process of
the command line string introduced last year by me because it is no
longer necessary by the above change on
`preview-undump-replacements'. Though this change disables -jobname
option again when lualatex is used with preamble cache, it would be
fine because that concerns only very old lualatex binaries and that
had always been the state before my commit just a year ago.
The above three modifications fix bug#31685 and bug#31686.
* tests/japanese/preview-latex.el
(japanese-preview-preserve-kanji-option2): Arrange with the above
change.
(japanese-preview-preserve-kanji-option3): New test.
(japanese-preview-error-quote-shift-jis): Remove spurious backslash.
* doc/preview-latex.texi (Key bindings and user-level lisp functions):
Add description about restriction of preamble cache on LaTeX variants.
---
doc/preview-latex.texi | 14 +++++++++++-
preview.el.in | 35 ++++++++++++++----------------
tests/japanese/preview-latex.el | 48 +++++++++++++++++++++++++++++++++++++----
3 files changed, 73 insertions(+), 24 deletions(-)
diff --git a/doc/preview-latex.texi b/doc/preview-latex.texi
index d89c5a9..2d4941c 100644
--- a/doc/preview-latex.texi
+++ b/doc/preview-latex.texi
@@ -10,7 +10,7 @@ This manual is for preview-latex, a @LaTeX{} preview mode for
@AUCTeX{}
(version @value{VERSION} from @value{UPDATED}).
Copyright @copyright{} 2001, 2002, 2003,
-2004, 2005, 2006, 2017 Free Software Foundation, Inc.
+2004, 2005, 2006, 2017, 2018 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -295,6 +295,18 @@ done from within Emacs, but it will not notice if the
preamble
effectively changes because some included file or style file is
tampered with.
+Note that support for preamble cache is limited for @LaTeX{} variants.
+c.f. @file{<URL:https://github.com/davidcarlisle/dpctex/issues/15>}
address@hidden @bullet
address@hidden
address@hidden cannot use preamble cache at all. The reason is intrinsic in
address@hidden, so @previewlatex{} can't help.
address@hidden
address@hidden works with preamble cache only when the preamble is simple
+enough, i.e., when it doesn't load opentype fonts and it doesn't use lua
+codes in preamble.
address@hidden itemize
+
@item @kbd{C-c C-p C-c C-f}
@itemx @code{preview-cache-preamble-off}
@itemx Preview/Turn preamble cache off
diff --git a/preview.el.in b/preview.el.in
index 7c7cecc..07dad50 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -3268,9 +3268,11 @@ This is passed through `preview-do-replacements'."
(defcustom preview-dump-replacements
'(preview-LaTeX-command-replacements
+ ;; If -kanji option exists, pick it up as the second match.
+ ;; Discard all other options.
("\\`\\([^ ]+\\)\
-\\(\\( +-\\([^ \\\\\"]\\|\\\\\\.\\|\"[^\"]*\"\\)*\\)*\\)\\(.*\\)\\'"
- . ("\\1 -ini -interaction=nonstopmode \"&\\1\" " preview-format-name
".ini \\5")))
+\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^
\\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*\\(.*\\)\\'"
+ . ("\\1 -ini \\2 -interaction=nonstopmode \"&\\1\" " preview-format-name
".ini \\3")))
"Generate a dump command from the usual preview command."
:group 'preview-latex
:type '(repeat
@@ -3278,10 +3280,13 @@ This is passed through `preview-do-replacements'."
(cons string (repeat (choice symbol string))))))
(defcustom preview-undump-replacements
+ ;; If -kanji option exists, pick it up as the second match.
+ ;; Discard all other options.
'(("\\`\\([^ ]+\\)\
- .*? \"\\\\input\" \"{\\\\detokenize{\" \\(.*\\) \"}}\"\\'"
- . ("\\1 -interaction=nonstopmode " preview-format-name
- " \"/AUCTEXINPUT{\" \\2 \"}\"")))
+\\(?: +\\(?:\\(--?kanji[= ][^ ]+\\)\\|-\\(?:[^
\\\"]\\|\\\\.\\|\"[^\"]*\"\\)*\\)\\)*.*\
+ \"\\\\input\" \"{\\\\detokenize{\" \\(.*\\) \"}}\"\\'"
+ . ("\\1 \\2 -interaction=nonstopmode -file-line-error "
+ preview-format-name " \"/AUCTEXINPUT{\" \\3 \"}\"")))
;; See the ini file code below in `preview-cache-preamble' for the
;; weird /AUCTEXINPUT construct. In short, it is crafted so that
;; dumped format file can read file of non-ascii name.
@@ -3326,13 +3331,13 @@ If FORMAT-CONS is non-nil, a previous format may get
reused."
(push format-cons preview-dumped-alist))
;; mylatex.ltx expects a file name to follow. Bad. `.tex'
;; in the tools bundle is an empty file.
- (write-region "\\ifx\\pdfoutput\\undefined\\else\
-\\let\\PREVIEWdump\\dump\\def\\dump{%
-\\edef\\next{{\\pdfoutput=\\the\\pdfoutput\\relax\
+ (write-region "\\let\\PREVIEWdump\\dump\\def\\dump{%
+\\edef\\next{{\\ifx\\pdfoutput\\undefined\\else\
+\\pdfoutput=\\the\\pdfoutput\\relax\\fi\
\\the\\everyjob}}\\everyjob\\next\\catcode`\\ 10 %
\\catcode`/ 0 %
-\\def\\AUCTEXINPUT##1{\\catcode`/ 12\\relax\\catcode`\\
9\\relax\\input{\\detokenize{##1}}}%
-\\let\\dump\\PREVIEWdump\\dump}\\fi\\input mylatex.ltx \\relax%\n" nil
dump-file)
+\\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
@@ -3534,15 +3539,7 @@ internal parameters, STR may be a log to insert into the
current log."
(if (consp (cdr dumped-cons))
(preview-do-replacements
command
- (append preview-undump-replacements
- ;; Since the command options provided in
- ;; (TeX-engine-alist) are dropped, give them
- ;; back.
- (list (list "\\`\\([^ ]+\\)"
- (TeX-command-expand "%(PDF)%(latex)"
- (if
TeX-current-process-region-p
- #'TeX-region-file
-
#'TeX-master-file))))))
+ preview-undump-replacements)
command) file))))
(condition-case err
(progn
diff --git a/tests/japanese/preview-latex.el b/tests/japanese/preview-latex.el
index 4831942..41907df 100644
--- a/tests/japanese/preview-latex.el
+++ b/tests/japanese/preview-latex.el
@@ -191,7 +191,7 @@ Did the image come out at the correct position? ")))
String encoded in `shift_jis' can have regexp meta characters in it."
(let (case-fold-search
(buffer-file-coding-system 'shift_jis))
- (dolist (str '("$BI=(B(1)" "$BM=(B{a}" "$BG=(B\|" "{$B$"(B}
%$BG=(B" "$B%"!<%9(B" "$B7?(B"))
+ (dolist (str '("$BI=(B(1)" "$BM=(B{a}" "$BG=(B|" "{$B$"(B}
%$BG=(B" "$B%"!<%9(B" "$B7?(B"))
(should (string-match (preview-error-quote str) str)))))
(ert-deftest japanese-preview-decode-^^ab ()
@@ -215,18 +215,23 @@ String encoded in `shift_jis' can have regexp meta
characters in it."
(should (string= (preview--convert-^^ab "^^c0^^Ab") "\xc0^^Ab"))))
(ert-deftest japanese-preview-preserve-kanji-option2 ()
- "`TeX-inline-preview-internal' preserve kanji option or not."
+ "Test command to use dumped format preserves kanji option or not."
(let ((TeX-clean-confirm nil)
;; Make `preview-call-hook' inactive.
(preview-image-creators nil)
- dummy process)
+ dummyfile process)
(unwind-protect
(save-window-excursion
(find-file preserve-kanji-option)
(setq dummyfile (TeX-master-file))
(delete-other-windows)
(setq process (TeX-inline-preview-internal
- "platex" dummyfile '(nil . nil) (current-buffer)
+ (preview-do-replacements
+ (TeX-command-expand
+ (preview-string-expand preview-LaTeX-command)
+ 'TeX-master-file)
+ preview-LaTeX-command-replacements)
+ dummyfile '(nil . nil) (current-buffer)
'(nil . (t . t)) dummyfile '(nil nil nil)))
(let ((cmd (process-command process)))
(should (string-match "-kanji" (nth (1- (length cmd)) cmd)))))
@@ -243,6 +248,41 @@ String encoded in `shift_jis' can have regexp meta
characters in it."
(delete-directory dir t)))
(kill-buffer))))
+(ert-deftest japanese-preview-preserve-kanji-option3 ()
+ "Test command to dump format file preserves kanji option or not."
+ (let ((TeX-clean-confirm nil)
+ ;; Make `preview-call-hook' inactive.
+ (preview-image-creators nil)
+ (preview-format-name "dummy")
+ dummyfile process)
+ (unwind-protect
+ (save-window-excursion
+ (find-file preserve-kanji-option)
+ (setq dummyfile (TeX-master-file))
+ (delete-other-windows)
+ (setq process (TeX-inline-preview-internal
+ (preview-do-replacements
+ (TeX-command-expand
+ (preview-string-expand preview-LaTeX-command)
+ 'TeX-master-file)
+ preview-dump-replacements)
+ dummyfile '(nil . nil) (current-buffer)
+ nil dummyfile '(nil nil nil)))
+ (let ((cmd (process-command process)))
+ (should (string-match "-kanji" (nth (1- (length cmd)) cmd)))))
+ ;; Cleanup.
+ (accept-process-output process)
+ (set-buffer (get-file-buffer preserve-kanji-option))
+ (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
+ (process (get-buffer-process buffer)))
+ (if process (delete-process process))
+ (kill-buffer buffer))
+ (TeX-clean t)
+ (dolist (dir preview-temp-dirs)
+ (if (file-exists-p (directory-file-name dir))
+ (delete-directory dir t)))
+ (kill-buffer))))
+
;;; preview-latex.el ends here
;; Local Variables:
- [elpa] externals/auctex 0d5c1c0 41/48: ; Fix last commit and push missing Makefile.in., (continued)
- [elpa] externals/auctex 0d5c1c0 41/48: ; Fix last commit and push missing Makefile.in., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 45747b9 42/48: Add \eqref to RefTeX's reference styles, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex a8ea127 29/48: Accept non-ascii file name in accord with change in TL 2018, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 48325a7 20/48: Update URLs further, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 8d30dc1 37/48: Add new style/marginnote.el, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 5df288d 44/48: ; Remove unwanted spaces., Tassilo Horn, 2018/09/16
- [elpa] externals/auctex a7cde09 47/48: Update style/lettrine.el to package version 2.21, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 31ee142 38/48: Fix regression of `TeX-view', Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 80bcd0a 46/48: Update style/lettrine.el to package version 2.1, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex 168a4a1 19/48: Update URLs, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex c3cf39e 34/48: Make preamble caching robust to LuaLaTeX and (u)pLaTeX,
Tassilo Horn <=
- [elpa] externals/auctex 03ba1fa 43/48: Add new style/ocg-p.el and style/ocgx.el, Tassilo Horn, 2018/09/16
- [elpa] externals/auctex f761ab4 48/48: Merge branch 'master' into externals/auctex, Tassilo Horn, 2018/09/16