Re: emiko: wrong usage of buffer-file-name
Yoichi NAKAYAMA <[email protected]> Mon, 18 Oct 2004 02:12:10 +0900
| Newsgroups | gmane.mail.emacs.mime.japanese |
|---|---|
| Organization | Geiin.org |
| Message-ID | <87d5zhclqt.wl%[email protected]> |
At Wed, 13 Oct 2004 13:59:53 +0900, Katsumi Yamaoka wrote: > (global-font-lock-mode 1) > > を使う代わりに、各 mode ごとに以下のような hook を設定する > > (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock) > > のは必ずしも邪道ではないと思うのですが、最初に set-auto-mode で > turn-on-font-lock が呼ばれたときに > font-lock-fontify-buffer-function の値が jit-lock-refontify になっ > てしまい、二回目に mime-view-insert-fontified-text-content が > font-lock-fontify-buffer を呼ぶと、font-lock が解除されてしまう > んですが、この問題を解決する妙案はありませんか? ad-hoc な解ですが、これではいかがでしょうか。 -- Yoichi NAKAYAMA
mime-view.el.diff
(application/octet-stream, 1.3 KB)
Index: mime-view.el =================================================================== RCS file: /cvs/root/semi/mime-view.el,v retrieving revision 1.150.2.33.2.38 diff -u -r1.150.2.33.2.38 mime-view.el --- mime-view.el 15 Sep 2004 15:16:54 -0000 1.150.2.33.2.38 +++ mime-view.el 17 Oct 2004 17:10:49 -0000 @@ -977,18 +977,20 @@ (buffer-disable-undo) (kill-all-local-variables) (mime-view-insert-text-content entity situation) - (if mode - (funcall mode) - (if (setq filename (mime-entity-filename entity)) - (unwind-protect - (progn - (setq buffer-file-name filename) - (set-auto-mode)) - (setq buffer-file-name nil)))) + (cond (mode + (funcall mode)) + ((setq filename (mime-entity-filename entity)) + (let ((buffer-file-name + (expand-file-name (file-name-nondirectory filename) + temporary-file-directory))) + (set-auto-mode)))) (require 'font-lock) (let ((font-lock-verbose nil)) ;; I find font-lock a bit too verbose. - (font-lock-fontify-buffer)) + (font-lock-fontify-buffer) + (when (and (boundp 'jit-lock-mode) + jit-lock-mode) + (jit-lock-fontify-now))) ;; By default, XEmacs font-lock uses non-duplicable text ;; properties. This code forces all the text properties ;; to be copied along with the text.