[mew-dist 23820] Re: color X Face

Tatsuya Kinoshita tats at example.com
2003年 7月 10日 (木) 23:09:50 JST


On July 10, 2003, [mew-dist 23818],
Kazu Yamamoto <kazu at example.com> wrote:

> > 外部パッケージの利用も考慮して、mew-use-highlight-x-face-function
> > を復活させませんか?
> 
> パッチを作ってくれると嬉しいです。

作ってみました。Mew 3用のパッチですが、Mew 4にもそのまま当たります。

-- 
木下達也

This patch is written by Tatsuya Kinoshita.  Copyright is disclaimed.

--- mew-highlight.el	2003/01/21 03:57:26	1.25
+++ mew-highlight.el	2003/07/10 13:59:10
@@ -173,27 +173,37 @@
 ;;;
 
 (defun mew-highlight-x-face (beg end)
-  (when (and mew-use-highlight-x-face window-system)
-    (save-excursion
-      (goto-char beg)
-      (mew-elet
-       (let ((regex1 "^X-Face: *\\(.*\\(\n[ \t].*\\)*\\)\n")
-	     (buf (current-buffer))
-	     overlay xface beg0 end0 xbmp)
-	 (while (re-search-forward regex1 end t)
-	   (setq beg0 (match-beginning 0))
-	   (setq end0 (match-end 0))
-	   (with-temp-buffer
-	     (mew-insert-buffer-substring
-	      buf (match-beginning 1) (match-end 1))
-	     (setq xbmp (mew-x-face-compface-to-xbm))
-	     (if xbmp (setq xface (mew-x-face-create))))
-	   (when xface
-	     (setq overlay (mew-overlay-make beg0 end0))
-	     (overlay-put overlay 'invisible t)
-	     (save-restriction
-	       (narrow-to-region beg end)
-	       (mew-x-face-display xface )))))))))
+  "A function to display X-Face."
+  (if (and mew-use-highlight-x-face mew-use-highlight-x-face-function)
+      (funcall mew-use-highlight-x-face-function beg end)))
+
+(cond
+ (mew-icon-p
+  (defvar mew-use-highlight-x-face-function
+    (lambda (beg end)
+      (when (and mew-use-highlight-x-face window-system)
+	(save-excursion
+	  (goto-char beg)
+	  (mew-elet
+	   (let ((regex1 "^X-Face: *\\(.*\\(\n[ \t].*\\)*\\)\n")
+		 (buf (current-buffer))
+		 overlay xface beg0 end0 xbmp)
+	     (while (re-search-forward regex1 end t)
+	       (setq beg0 (match-beginning 0))
+	       (setq end0 (match-end 0))
+	       (with-temp-buffer
+		 (mew-insert-buffer-substring
+		  buf (match-beginning 1) (match-end 1))
+		 (setq xbmp (mew-x-face-compface-to-xbm))
+		 (if xbmp (setq xface (mew-x-face-create))))
+	       (when xface
+		 (setq overlay (mew-overlay-make beg0 end0))
+		 (overlay-put overlay 'invisible t)
+		 (save-restriction
+		   (narrow-to-region beg end)
+		   (mew-x-face-display xface)))))))))))
+ (t
+  (defvar mew-use-highlight-x-face-function nil)))
 
 (defun mew-x-face-compface-to-xbm ()
   (when (and (mew-which-exec mew-prog-uncompface)




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