8.13.2008

わたしの.emacs

暑さにバテながらいろいろ考えてみたところ、私にとって最も重要なファイルがこれであろうという結論に達した。

さて、そんな悟りはおいとき、実は以前からemacs22にして以来(というかLennyにして以来)、Shellモードで日本語がうまく表示されないという不具合に悩まされていた。

今回も、以前にサポートブログで紹介したようなやり方でemacs環境をUTF-8に整え、環境変数$LANGもja_JP.UTF-8にしてあるから、当然の如くshellモードでも日本語が表示されるんだと思っていた。

けれど、実際使ってみるとそうではなく、ここしばらく、特にSDLを使ったプログラムをコンパイルするときに、頻繁にShellモードを呼び出さなくちゃいけなくなってから、この問題をなんとか解決できないものかと悩んでいたのだ。

で、今日一応の解決を見たのでその結果とともに.emacsを張り付けておこうと思う。

まずは.emacsから。

;;.emacs
(setq inhibit-startup-message t)

(set-locale-environment nil)
(coding-system-put 'utf-8 'category 'utf-8)
(set-language-info
"Japanese"
'coding-priority (cons 'utf-8
(get-language-info "Japanese" 'coding-priority)))
(set-language-environment "Japanese")
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-buffer-file-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(global-font-lock-mode t)
(setq backup-inhibited t)
(setq delete-auto-save-file t)

;; scheme-mode
(autoload 'scheme-mode "scheme-mode" "scheme" t)
(setq auto-mode-alist (cons '("\.ss$" . scheme-mode) auto-mode-alist))

;; html-helper-mode
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
(setq auto-mode-alist (cons '("\.html$" . html-helper-mode) auto-mode-alist))

;; css-mode
(autoload 'css-mode "css-mode" "Editing CSS" t)
(setq auto-mode-alist (cons '("\.css$" . css-mode) auto-mode-alist))

;; region
(setq transient-mark-mode t)

;; show clock
(display-time)

;; show column number
(column-number-mode t)

;; anthy
(push "/usr/local/share/emacs/site-lisp/anthy/" load-path)
(load-library "leim-list")
(load-library "anthy")

;; uim
(push "/usr/local/share/emacs/site-lisp/uim-el/" load-path)
(require 'uim-leim)
(setq default-input-method "japanese-anthy-uim")
(setq uim-default-im-prop '("action_anthy_hiragana"))
(setq uim-candidate-display-inline t)

(show-paren-mode t)
(setq show-paren-style 'mixed)

;; scheme
(setq process-coding-system-alist
(cons '("gosh" utf-8 . utf-8) process-coding-system-alist))

;; gosh interpriter path. -i option is interactive mode
(setq gosh-program-name "/usr/bin/gosh -i")

;; scheme-mode and run-scheme-mode use to cmuscheme.el
(autoload 'scheme-mode "cmuscheme" "Major mode for Scheme." t)
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme process." t)

;; pair of brace
(show-paren-mode)

;; indent
(put 'and-let* 'scheme-indent-function 1)
(put 'begin0 'scheme-indent-function 0)
(put 'call-with-client-socket 'scheme-indent-function 1)
(put 'call-with-input-conversion 'scheme-indent-function 1)
(put 'call-with-input-file 'scheme-indent-function 1)
(put 'call-with-input-process 'scheme-indent-function 1)
(put 'call-with-input-string 'scheme-indent-function 1)
(put 'call-with-iterator 'scheme-indent-function 1)
(put 'call-with-output-conversion 'scheme-indent-function 1)
(put 'call-with-output-file 'scheme-indent-function 1)
(put 'call-with-output-string 'scheme-indent-function 0)
(put 'call-with-temporary-file 'scheme-indent-function 1)
(put 'call-with-values 'scheme-indent-function 1)
(put 'dolist 'scheme-indent-function 1)
(put 'dotimes 'scheme-indent-function 1)
(put 'if-match 'scheme-indent-function 2)
(put 'let*-values 'scheme-indent-function 1)
(put 'let-args 'scheme-indent-function 2)
(put 'let-keywords* 'scheme-indent-function 2)
(put 'let-match 'scheme-indent-function 2)
(put 'let-optionals* 'scheme-indent-function 2)
(put 'let-syntax 'scheme-indent-function 1)
(put 'let-values 'scheme-indent-function 1)
(put 'let/cc 'scheme-indent-function 1)
(put 'let1 'scheme-indent-function 2)
(put 'letrec-syntax 'scheme-indent-function 1)
(put 'make 'scheme-indent-function 1)
(put 'multiple-value-bind 'scheme-indent-function 2)
(put 'match 'scheme-indent-function 1)
(put 'parameterize 'scheme-indent-function 1)
(put 'parse-options 'scheme-indent-function 1)
(put 'receive 'scheme-indent-function 2)
(put 'rxmatch-case 'scheme-indent-function 1)
(put 'rxmatch-cond 'scheme-indent-function 0)
(put 'rxmatch-if 'scheme-indent-function 2)
(put 'rxmatch-let 'scheme-indent-function 2)
(put 'syntax-rules 'scheme-indent-function 1)
(put 'unless 'scheme-indent-function 1)
(put 'until 'scheme-indent-function 1)
(put 'when 'scheme-indent-function 1)
(put 'while 'scheme-indent-function 1)
(put 'with-builder 'scheme-indent-function 1)
(put 'with-error-handler 'scheme-indent-function 0)
(put 'with-error-to-port 'scheme-indent-function 1)
(put 'with-input-conversion 'scheme-indent-function 1)
(put 'with-input-from-port 'scheme-indent-function 1)
(put 'with-input-from-process 'scheme-indent-function 1)
(put 'with-input-from-string 'scheme-indent-function 1)
(put 'with-iterator 'scheme-indent-function 1)
(put 'with-module 'scheme-indent-function 1)
(put 'with-output-conversion 'scheme-indent-function 1)
(put 'with-output-to-port 'scheme-indent-function 1)
(put 'with-output-to-process 'scheme-indent-function 1)
(put 'with-output-to-string 'scheme-indent-function 1)
(put 'with-port-locking 'scheme-indent-function 1)
(put 'with-string-io 'scheme-indent-function 1)
(put 'with-time-counter 'scheme-indent-function 1)
(put 'with-signal-handlers 'scheme-indent-function 1)
(put 'with-locking-mutex 'scheme-indent-function 1)
(put 'guard 'scheme-indent-function 1)

;; memo
(setq user-full-name "My Name")
(setq user-mail-address "email@post.com")
(defun memo ()
(interactive)
(add-change-log-entry
nil
(expand-file-name "~/.memo/memo.txt")))
(define-key ctl-x-map "M" 'memo)

;; password hide
(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt)

;; c-mode hook
(add-hook 'c-mode-hook
'(lambda ()
(c-set-style "BSD")))

(add-hook 'c++-mode-hook
'(lambda ()
(c-set-style "BSD")))

;; ls color mode off
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

;; w3m
(require 'w3m-load)

;; wget-el
(load "w3m-wget")


ポイントは、太字で示したところと斜体で示したところ。
どうやら、太字部分斜体部分よりも前に定義されていないと、正常にエンコしてくれない様子。
(いろいろと順序を変えて試行錯誤しながらやった結果なので、外しているかもしれないけど。)

もし同様の症状でお困りなら、試してみるといいかもですよ。

0 件のコメント: