emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auctex ff08d38 28/48: Fix region compilation with \usep


From: Tassilo Horn
Subject: [elpa] externals/auctex ff08d38 28/48: Fix region compilation with \usepackage[utf8]{inputenc}
Date: Sun, 16 Sep 2018 01:47:24 -0400 (EDT)

branch: externals/auctex
commit ff08d38666f10050f93b6cc4c5777420f30a0409
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>

    Fix region compilation with \usepackage[utf8]{inputenc}
    
    * tex-buf.el (TeX-quote-filename): Wrap non-ascii characters in
    \unexpanded{} for non UTF-8 LaTeX so that raw file name is recovered.
---
 tex-buf.el | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/tex-buf.el b/tex-buf.el
index ad6dad6..eed31f2 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -2032,7 +2032,33 @@ The hooks are run in the region buffer, you may use the 
variable
     (while (setq pos (string-match "[~#]" file pos))
       (setq file (replace-match "\\\\string\\&" t nil file 0)
            pos (+ pos 8))))
-  file)
+  ;; Use \unexpanded so that \message outputs the raw file name.
+  ;; When \usepackage[utf8]{inputenc} is used in standard (pdf)latex,
+  ;; \message does not output non-ascii file name in raw form without
+  ;; \enuexpanded, which makes AUCTeX to fail to recognize the file
+  ;; names right when analysing the process output buffer.
+  ;; Note that \usepackage[utf8]{inputenc} is enabled by default in
+  ;; standard (pdf)latex since TeXLive 2018.
+  (if (and (memq major-mode '(latex-mode doctex-mode))
+          ;; Japanese upLaTeX requires the same treatment with
+          ;; respect to non-ascii characters other than Japanese, in
+          ;; file names within \message{}.
+          ;; However, pLaTeX (non u- version) does not support
+          ;; non-ascii file name encoded in UTF-8.  So considering
+          ;; `ptex' doesn't make sense here.  We cater for only
+          ;; `default' and `uptex' engines.
+          (memq TeX-engine '(default uptex)))
+      ;; It would fail to put entire `file' inside \unexpanded{} when
+      ;; the above loop injects \string before "#" and "~".  So put
+      ;; only multibyte characters inside \unexpanded{}.
+      ;; It is safe in upLaTeX to use \unexpanded{} on Japanese
+      ;; characters though they are handled by upLaTeX in a totally
+      ;; different way from inputenc.
+      ;; Thus put all multibyte characters, without considering
+      ;; whether they are Japanese or not, inside \unexpanded{}.
+      (replace-regexp-in-string "[[:multibyte:]]+"
+                               "\\\\unexpanded{\\&}" file t)
+    file))
 
 (defvar font-lock-mode-enable-list)
 (defvar font-lock-auto-fontify)



reply via email to

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