diff yatexlib.el @ 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 c0827f80b18e
children b6853d450b0a
line wrap: on
line diff
--- 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

yatex.org