default coding system.....

どうしてもデフォルトコーディングシステムの切り替え方法が分からない。.emacsを消してみても、日本語ファイルを開くと日本語モード J になる。で、このcodingが utf-8 でないという罠。

空のファイルなんかはちゃんと utf-8 U になっているので、default-coding-system は utf-8 なんだけどねぇ。

?もしかしたら html ファイルだから? どうも coding system は iso-2022-jp になっている予感。。。。

正解らしい。例えば text.txt でなら日本語だろうとなんだろうと U。同じファイルを text.html にリネームすると J 。 yahtml ?

ほほう。たしかにyahtmlですね。yahtml を外せば test.html をユニコードと判別する。では yahtml の設定か。

という記述を見つけた。なに utf-8 は選べない?
yahtml の info には


-- Variable: yahtml-kanji-code
デフォルトの漢字コード。1=sjis, 2=jis, 3=euc (2)
.htaccess ファイルに
AddType "text/html; charset=xxx" .htmlの記述があった場合はそれ

とありますねぇ。うーん。追加ファイルを作る必要があるのか。。。

と思いきや、Ubuntu 10.4 の yatexlib.el には


(defvar latex-message-kanji-code 2
"*Kanji coding system latex command types out.
1 = Shift JIS, 2 = JIS, 3 = EUC. 4 = UTF-8")

(defvar YaTeX-kanji-code-alist
(cond
*1
(YaTeX-macos (if (boundp '*sjis-mac*) *sjis-mac* *sjis*mac))
(t *sjis*)))
'(2 . *junet*) '(3 . *euc-japan*)))
*2
;;(cdr-safe(assq 'coding-system (assoc "Japanese" language-info-alist)))
(list '(0 . no-conversion)
(cons
1 (cond (YaTeX-dos 'shift_jis-dos)
(YaTeX-macos 'shift_jis-mac)
*3 'shift_jis-unix)
(t 'sjis)))
'(2 . iso-2022-jp-unix)
'(3 . euc-jp-unix)
'(4 . utf-8))))
"Kanji-code expression translation table.")


と 4 を選べばよさげ。さて、

結果として .emacs


(setq auto-mode-alist
(cons (cons "\\.html$" 'yahtml-mode) auto-mode-alist))
(autoload 'yahtml-mode "yahtml" "Yet Another HTML mode" t)
(setq yahtml-kanji-code 4) ; (1 sjis, 2 jis, 3 euc, 4 utf-8)

としたら問題解決。よかったよかった。

Meadow で問題なくつかえていたのは、 yahtml を使っていなかったからですね。ふむふむ。

分かってみれば、yahtml utf-8 でぐぐればいろいろ出てきますね。しかし時間がすこしかかった。

*1:boundp '*junet*) (list '(0 . *noconv*) (cons 1 (cond (YaTeX-dos (if (boundp '*sjis-dos*) *sjis-dos* *sjis*dos

*2:and YaTeX-emacs-20 (featurep 'mule

*3:member 'shift_jis (coding-system-list