[Mew-dist 2108] Re: font-lock for Mew

OHIRA Fumiaki bun at example.com
1997年 9月 18日 (木) 10:31:38 JST


大平です。

From: Yoshinobu Yamasoto <yamasoto at example.com>
Subject: [Mew-dist 2068] font-lock for Mew
Date: Wed, 17 Sep 1997 01:02:08 +0900
Message-ID: <19970917010208R.yamasoto at example.com>

> ところが,現在 Emacs 20.0.94.1 を使っているのですが,これだとうまく色
> がつかなくなってしまいました.どうやら,font-lockまわりが変わってしまっ
> たせいみたいなのですが,どなたか Emacs 20.0 用に設定されてる方はいらっ
> しゃらないでしょうか?

私は 20.0.91 で font-lock を使って色をつけてます。
いろいろな人の設定を参考にして少しずつ設定を変更していったので
変なことやってるかもしれませんが、私の環境ではとりあえずこれで
うまくいってます。
20.0.94 では emacs 自体がうまく動かなかったのでためせていません。


(defun my-mew-message-font-lock ()
  (require 'font-lock)
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '(my-mew-message-font-lock-keywords t t))
  (font-lock-mode 1))

(defun my-mew-summary-font-lock ()
  (require 'font-lock)
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '(my-mew-summary-font-lock-keywords t t))
  (font-lock-mode 1))

(if window-system
    (progn
      (copy-face 'bold 'my-mew-message-subject-face)
      (set-face-foreground 'my-mew-message-subject-face "Blue")
      (setq my-mew-message-subject-face 'my-mew-message-subject-face)
      
      (copy-face 'bold 'my-mew-message-from-face)
      (set-face-foreground 'my-mew-message-from-face "Purple")
      (setq my-mew-message-from-face 'my-mew-message-from-face)

      (copy-face 'bold 'my-mew-message-header-face)
      (set-face-foreground 'my-mew-message-header-face "Firebrick")
      (setq my-mew-message-header-face 'my-mew-message-header-face)

      (copy-face 'default 'my-mew-message-quote-face)
      (set-face-foreground 'my-mew-message-quote-face "ForestGreen")
      (setq my-mew-message-quote-face 'my-mew-message-quote-face)

      (copy-face 'default 'my-mew-message-comment-face)
      (set-face-foreground 'my-mew-message-comment-face "gray50")
      (setq my-mew-message-comment-face 'my-mew-message-comment-face)

      (copy-face 'bold 'my-mew-message-important-face)
      (set-face-foreground 'my-mew-message-important-face "Orange Red")
      (setq my-mew-message-important-face 'my-mew-message-important-face)

      (copy-face 'default 'my-mew-message-default-face)
      (set-face-foreground 'my-mew-message-default-face "Black")
      (setq my-mew-message-default-face 'my-mew-message-default-face)


      (setq my-mew-message-font-lock-keywords
	'(("\\(^Subject: .*$\\)" 1 my-mew-message-subject-face t)
	  ("\\(^From: .*$\\)" 1 my-mew-message-from-face t)
	  ("\\(^[ \t]*>.*$\\)" 1 my-mew-message-quote-face t)
	  ("\\(^X-.*: .*$\\)" 1 my-mew-message-quote-face t)
	  ("\\(^X-Face: .*$\\)" 1 my-mew-message-default-face t)
	  ("\\(\\(^#+\\|^#+\\).*\\)" 1 my-mew-message-comment-face t)
	  ("\\(^[A-Za-z][A-Za-z0-9'-]+: \\)" 1 my-mew-message-header-face t)
	  ("\\(^From: \\|^To: \\|^Reply-To: \\|^Cc: \\|^Subject: \\|^Newsgroups: \\|^Apparently-To: \\|^Sender: \\|^X-.*Mailer: .*\\|X-Newsreader: .*\\)" 1 my-mew-message-important-face t)
	  ))

      (copy-face 'default 'my-mew-summary-mark-face)
      (set-face-foreground 'my-mew-summary-mark-face "Blue")
      (setq my-mew-summary-mark-face 'my-mew-summary-mark-face)
      
      (copy-face 'default 'my-mew-summary-mark2-face)
      (set-face-foreground 'my-mew-summary-mark2-face "Purple")
      (setq my-mew-summary-mark2-face 'my-mew-summary-mark2-face)

      (copy-face 'default 'my-mew-summary-delete-face)
      (set-face-foreground 'my-mew-summary-delete-face "Firebrick")
      (setq my-mew-summary-delete-face 'my-mew-summary-delete-face)

      (copy-face 'default 'my-mew-summary-move-face)
      (set-face-foreground 'my-mew-summary-move-face "ForestGreen")
      (setq my-mew-summary-move-face 'my-mew-summary-move-face)

      (setq my-mew-summary-font-lock-keywords
	    '(("\\(^[ \t]+[0-9]+\\*.*\\)" 1 my-mew-summary-mark-face t)
	      ("\\(^[ \t]+[0-9]+ at example.com*\\)"  1 my-mew-summary-mark2-face t)
	      ("\\(^[ \t]+[0-9]+D.*\\)"  1 my-mew-summary-delete-face t)
	      ("\\(^[ \t]+[0-9]+o.*\\)"  1 my-mew-summary-move-face t)))

      (add-hook 'mew-draft-mode-hook
		(function
		 (lambda ()
		   (my-mew-message-font-lock)
		   (add-to-list 'mew-fields "Distribution:")
		   )))
      (require 'x-face-mule)
      (add-hook 'mew-message-hook 'x-face-decode-message-header)
      (add-hook 'mew-message-mode-hook 'my-mew-message-font-lock)
      (add-hook 'mew-summary-mode-hook 'my-mew-summary-font-lock)
      ))


--
大平 文明   Mailto:bun at example.com
大阪大学大学院理学研究科物理学専攻博士課程前期2年 



Mew-dist メーリングリストの案内