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  d4d2ab537ff08f09ae5587aeb1e2e937f7cecfa3 (commit)
      from  63a83c376142ae47a45420830964dda65d3d6e37 (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 d4d2ab537ff08f09ae5587aeb1e2e937f7cecfa3
Author: Ikumi Keita <ik...@ikumi.que.jp>
Date:   Wed Apr 27 22:36:48 2016 +0900

    Enable directory local variables in japanese-{latex, plain-tex}-mode
    
        * tex-jp.el (japanese-latex-mode-initialization): Set
        `major-mode' to `japanese-latex-mode' and reset it to
        `latex-mode' after `hack-local-variables' is done.
        (japanese-plain-tex-mode-initialization): Similar changes
        for `japanese-plain-tex-mode'.
        (japanese-TeX-reset-mode-name): New function.
        (top-level) Make `latex-mode' is regarded as parent of
        `japanese-latex-mode' in directory local variables.  Similar
        addition for `japanese-plain-tex-mode', too.
    
    Signed-off-by: Mosè Giordano <m...@gnu.org>

diff --git a/tex-jp.el b/tex-jp.el
index 75b49b2..bdb1185 100644
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -399,7 +399,13 @@ Set `japanese-TeX-mode' to t, and enter 
`TeX-plain-tex-mode'."
   "Japanese plain-TeX specific initializations."
   (when japanese-TeX-mode
 ;    (setq TeX-command-default japanese-TeX-command-default)
-    (TeX-engine-set japanese-TeX-engine-default)))
+    (TeX-engine-set japanese-TeX-engine-default)
+
+    ;; For the intent of the following lines, see the comments below
+    ;; in `japanese-latex-mode-initialization'.
+    (setq major-mode 'japanese-plain-tex-mode)
+    (add-hook 'hack-local-variables-hook 'japanese-TeX-reset-mode-name
+             nil t)))
 
 (add-hook 'plain-TeX-mode-hook 'japanese-plain-tex-mode-initialization)
 
@@ -431,10 +437,41 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'."
 ;    (setq TeX-command-BibTeX
 ;        (if (and (eq TeX-engine 'ptex) (executable-find "pbibtex"))
 ;            "pBibTeX" "jBibTeX"))
-))
+
+    ;; The value of `major-mode' should be `latex-mode', not
+    ;; `japanese-latex-mode', because the name `latex-mode' is hard
+    ;; coded in several places of AUCTeX like "(eq major-mode
+    ;; 'latex-mode)", "(memq major-mode '(doctex-mode latex-mode)" and
+    ;; so on.  By such piece of codes, `japanese-latex-mode' should
+    ;; simply be regarded as `latex-mode'.  So we'd like to leave
+    ;; `major-mode' as `latex-mode' here, but doing so confuses
+    ;; `hack-local-variables' in two ways.
+    ;; (1) It is tricked into considering that the major mode is not
+    ;;     yet initialized and calls `japanese-latex-mode' again.
+    ;; (2) It does not read the directory local variables prepared for
+    ;;     `japanese-latex-mode'.
+    ;; Thus we temporarily set `major-mode' to `japanese-latex-mode'
+    ;; here and plan to reset it to `latex-mode' after
+    ;; `hack-local-variables' is done.
+    (setq major-mode 'japanese-latex-mode)
+    (add-hook 'hack-local-variables-hook 'japanese-TeX-reset-mode-name
+             nil t)))
 
 (add-hook 'LaTeX-mode-hook 'japanese-latex-mode-initialization)
 
+;; This function is useful only within `hack-local-variables-hook'.
+(defun japanese-TeX-reset-mode-name ()
+  (cond ((eq major-mode 'japanese-latex-mode)
+        (setq major-mode 'latex-mode))
+       ((eq major-mode 'japanese-plain-tex-mode)
+        (setq major-mode 'plain-tex-mode)))
+  (remove-hook 'hack-local-variables-hook 'japanese-TeX-reset-mode-name t))
+
+;; Make `hack-dir-local-variables' to regard `latex-mode' as parent
+;; of `japanese-latex-mode', and `plain-tex-mode' as parent of
+;; `japanese-plain-tex-mode'.
+(put 'japanese-plain-tex-mode 'derived-mode-parent 'plain-tex-mode)
+(put 'japanese-latex-mode 'derived-mode-parent 'latex-mode)
 
 ;;; Support for various self-insert-command
 

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

Summary of changes:
 tex-jp.el |   41 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 39 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX

_______________________________________________
auctex-diffs mailing list
auctex-di...@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-diffs

Reply via email to