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

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

[elpa] externals/auctex ff07544 05/42: Delay setting Japanese TeX engine


From: Tassilo Horn
Subject: [elpa] externals/auctex ff07544 05/42: Delay setting Japanese TeX engine in `japanese-latex-mode'
Date: Thu, 23 Nov 2017 06:06:06 -0500 (EST)

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

    Delay setting Japanese TeX engine in `japanese-latex-mode'
    
    * tex-jp.el (japanese-latex-mode-initialization): The part which
    guesses and sets `TeX-engine' using `TeX-match-style' is factored out
    and put in `TeX-update-style-hook'.  `TeX-match-style' eventually
    triggers `TeX-update-style', which isn't appropriate in
    `LaTeX-mode-hook'.
    (japanese-LaTeX-guess-engine): New function.
---
 tex-jp.el | 43 ++++++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/tex-jp.el b/tex-jp.el
index 09909ba..b1663db 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -526,7 +526,6 @@ Set `japanese-TeX-mode' to t, and enter 
`TeX-plain-tex-mode'."
 (defun japanese-plain-tex-mode-initialization ()
   "Japanese plain-TeX specific initializations."
   (when japanese-TeX-mode
-;    (setq TeX-command-default japanese-TeX-command-default)
     (TeX-engine-set japanese-TeX-engine-default)
 
     ;; For the intent of the following lines, see the comments below
@@ -549,21 +548,16 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
 (defun japanese-latex-mode-initialization ()
   "Japanese LaTeX specific initializations."
   (when japanese-TeX-mode
-;    (setq TeX-command-default japanese-LaTeX-command-default)
-    (TeX-engine-set
-     (cond
-      ((TeX-match-style "\\`u[jt]\\(article\\|report\\|book\\)\\'")
-       'uptex)
-      ((TeX-match-style "\\`[jt]s?\\(article\\|report\\|book\\)\\'")
-       (if (LaTeX-match-class-option "\\`uplatex\\'")
-          'uptex 'ptex))
-      ((TeX-match-style "\\`j-\\(article\\|report\\|book\\)\\'")
-       'jtex)
-      (t japanese-TeX-engine-default)))
+    ;; `TeX-match-style' $B$r;H$&$N$O(B `TeX-update-style' 
$B$N8e$KCY$i$;$k!#(B
+    ;; $B$3$NCJ3,$G;H$&$H!"$=$NCf$G8F$V(B `TeX-style-list' $B$NCf$G(B
+    ;; `TeX-update-style' $B$,8F$P$l$F$7$^$$!"(Blocal variable 
$BEy$N=`Hw$,(B
+    ;; address@hidden,$G(B style hook $B$,<B9T$5$l$FITE,$J7k2L$K$J$k$3$H$,(B
+    ;; $B$"$k!#$^$?!"(B`TeX-update-style' $B$O8e$+$i(B `find-file-hook' 
$BCf$G$b(B
+    ;; $B$&0lEY8F$P$l$k$N$G!"(B`TeX-parse-self' $B$,(B t address@hidden(B 
parse $B=hM}$bL5BL(B
+    ;; $B$K(B 2 $B2s9T$o$l$F$7$^$&!#(B
+    (add-hook 'TeX-update-style-hook
+             #'japanese-LaTeX-guess-engine nil t)
     (setq LaTeX-default-style japanese-LaTeX-default-style)
-;    (setq TeX-command-BibTeX
-;        (if (and (eq TeX-engine 'ptex) (executable-find "pbibtex"))
-;            "pBibTeX" "jBibTeX"))
 
     (when (and (fboundp 'font-latex-add-keywords)
               (eq TeX-install-font-lock 'font-latex-setup))
@@ -609,6 +603,25 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
 (put 'japanese-plain-tex-mode 'derived-mode-parent 'plain-tex-mode)
 (put 'japanese-latex-mode 'derived-mode-parent 'latex-mode)
 
+(defun japanese-LaTeX-guess-engine ()
+  "Guess Japanese TeX engine and set it to `TeX-engine'.
+Document class and its option is considered in the guess.  Do not
+overwrite the value already set locally."
+  ;; `TeX-engine' may be set by the file local variable or by the menu
+  ;; Command->TeXing Options manually.  Don't override the user
+  ;; preference set in such ways.
+  (unless (local-variable-p 'TeX-engine (current-buffer))
+    (TeX-engine-set
+     (cond
+      ((TeX-match-style "\\`u[jt]\\(?:article\\|report\\|book\\)\\'")
+       'uptex)
+      ((TeX-match-style "\\`[jt]s?\\(?:article\\|report\\|book\\)\\'")
+       (if (LaTeX-match-class-option "\\`uplatex\\'")
+          'uptex 'ptex))
+      ((TeX-match-style "\\`j-\\(?:article\\|report\\|book\\)\\'")
+       'jtex)
+      (t japanese-TeX-engine-default)))))
+
 ;;; Support for various self-insert-command
 
 (fset 'japanese-TeX-self-insert-command



reply via email to

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