changeset 503:d675f6d06481 dev

Format string `%k' in tex-command replaced to kanji-coding mnemonic. Thus, (setq tex-command "platex -kanji=%k") is acceptable.
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 02 Jan 2018 21:22:04 +0900
parents db7a90bd4621
children 4b5055c54331
files yatex.el yatexlib.el yatexprc.el
diffstat 3 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/yatex.el	Sun Dec 10 22:01:03 2017 +0900
+++ b/yatex.el	Tue Jan 02 21:22:04 2018 +0900
@@ -1,6 +1,6 @@
 ;;; yatex.el --- Yet Another tex-mode for emacs //쒹// -*- coding: sjis -*-
 ;;; (c)1991-2017 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Sun Sep 17 10:22:43 2017 on firestorm
+;;; Last modified Tue Jan  2 19:26:15 2018 on firestorm
 ;;; $Id$
 ;;; The latest version of this software is always available at;
 ;;; https://www.yatex.org/
@@ -49,11 +49,16 @@
 
 (defvar tex-command
   (cond
-   (YaTeX-use-LaTeX2e "platex")
+   (YaTeX-use-LaTeX2e "platex -kanji=%k")
    (YaTeX-japan "jlatex")
    (t "latex"))
   "*Default command for typesetting LaTeX text.
-Overridden with `%#! CommandLine...' in the buffer.")
+Overridden with `%#! CommandLine...' in the buffer.
+`%'s followed by a character are replaced as follows:
+%f -> Parent(main) document file name
+%r -> %f without extension
+%k -> One of Kanji code mnemonic: euc, jis, sjis, utf8
+")
 
 (defvar bibtex-command (if YaTeX-japan "jbibtex" "bibtex")
   "*Default command of BibTeX.
--- a/yatexlib.el	Sun Dec 10 22:01:03 2017 +0900
+++ b/yatexlib.el	Tue Jan 02 21:22:04 2018 +0900
@@ -1,7 +1,7 @@
 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*-
 ;;; 
 ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Sun Sep 17 10:23:31 2017 on firestorm
+;;; Last modified Tue Jan  2 17:50:03 2018 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -121,6 +121,25 @@
 
 ;---------- Define default key bindings on YaTeX mode map ----------
 ;;;###autoload
+(defun YaTeX-kanji-ptex-mnemonic ()
+  "Return the kanji-mnemonic of pTeX from current buffer's coding-system."
+  (if (boundp 'NEMACS)
+      (or (cdr-safe (assq kanji-fileio-code
+			  '((1 . "sjis") (2 . "jis") (3 . "euc"))))
+	  "")
+    (let ((coding
+	   (cond
+	    ((boundp 'buffer-file-coding-system)
+	     (symbol-name buffer-file-coding-system))
+	    ((boundp 'file-coding-system) (symbol-name file-coding-system))))
+	  (case-fold-search t))
+      (cond ((string-match "utf-8\\>" coding)			"utf-8")
+	    ((string-match "shift.jis\\|cp932\\>" coding)	"sjis")
+	    ((string-match "junet\\|iso.2022" coding)		"jis")
+	    ((string-match "euc.jp\\|ja.*iso.8bit" coding)	"euc")
+	    (t "")))))
+
+;;;###autoload
 (defun YaTeX-define-key (key binding &optional map)
   "Define key on YaTeX-prefix-map."
   (if YaTeX-inhibit-prefix-letter
--- a/yatexprc.el	Sun Dec 10 22:01:03 2017 +0900
+++ b/yatexprc.el	Tue Jan 02 21:22:04 2018 +0900
@@ -1,7 +1,7 @@
 ;;; yatexprc.el --- YaTeX process handler -*- coding: sjis -*-
 ;;; 
 ;;; (c)1993-2017 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Mon Oct 30 21:00:21 2017 on firestorm
+;;; Last modified Tue Jan  2 17:50:40 2018 on firestorm
 ;;; $Id$
 
 ;;; Code:
@@ -1351,7 +1351,8 @@
 	(t (concat (substring magic 0 (string-match "\\s [^-]\\S *$" magic)) " "))))
       (t (concat tex-command " " (if switch parent))))
      (list (cons "f" tparent)
-	   (cons "r" (substring tparent 0 (rindex tparent ?.)))))))
+	   (cons "r" (substring tparent 0 (rindex tparent ?.)))
+	   (cons "k" (YaTeX-kanji-ptex-mnemonic))))))
 
 (defvar YaTeX-lpr-command-history nil
   "Holds command line history of YaTeX-lpr.")