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. c3cf39e2c7b79c5e7de89


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. c3cf39e2c7b79c5e7de8966ad55dfedc490cec1b
Date: Tue, 12 Jun 2018 02:10:17 -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  c3cf39e2c7b79c5e7de8966ad55dfedc490cec1b (commit)
      from  5ce08ab0cc013b934e2dd65bf8ae4f73be35a572 (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 c3cf39e2c7b79c5e7de8966ad55dfedc490cec1b
Author: Ikumi Keita <address@hidden>
Date:   Mon Jun 4 22:47:49 2018 +0900

    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.

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:

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

Summary of changes:
 doc/preview-latex.texi          | 14 +++++++++++-
 preview.el.in                   | 35 ++++++++++++++----------------
 tests/japanese/preview-latex.el | 48 +++++++++++++++++++++++++++++++++++++----
 3 files changed, 73 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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