Hi Mosè,

> I'd like to install your patch, could you please send it in the format
> you sent previous patches?  git can't read the header of this patch.

Hmm, sounds strange.  With my experience with git, `git am' really
accepted the format I sent (the output of `hg export') as Uwe's message
http://lists.gnu.org/archive/html/auctex-devel/2016-04/msg00030.html
implies...

Anyway, I attach the recreated patch to this mail.  Sorry for
inconvenience.

Bye,
Ikumi Keita

>From [email protected] Wed Apr 27 22:36:48 2016
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [PATCH] Enable directory local variables in japanese-{latex,
 plain-tex}-mode
X-Mercurial-Node: fd09ad99541dc434d3d46cc2960ebd5ea5114151
X-Mercurial-Series-Index: 1
X-Mercurial-Series-Total: 1
Message-Id: <[email protected]>
X-Mercurial-Series-Id: <[email protected]>
User-Agent: Mercurial-patchbomb/3.7.3
Date: Wed, 27 Apr 2016 22:36:48 +0900
From: Ikumi Keita <[email protected]>
To: dummy

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

diff --git a/tex-jp.el b/tex-jp.el
--- a/tex-jp.el
+++ b/tex-jp.el
@@ -399,7 +399,13 @@
   "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 @@
 ;    (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
 


_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to