changeset 31802:c182c9b42c86

(gnus-article-display-xface): Use unibyte for the image processing. Rationalize logic somewhat.
author Dave Love <fx@gnu.org>
date Thu, 21 Sep 2000 09:23:32 +0000
parents 9de0c3880281
children 1430a37286eb
files lisp/gnus/gnus-ems.el
diffstat 1 files changed, 35 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/gnus-ems.el	Thu Sep 21 09:07:11 2000 +0000
+++ b/lisp/gnus/gnus-ems.el	Thu Sep 21 09:23:32 2000 +0000
@@ -208,44 +208,43 @@
 for XEmacs."
   ;; It might be worth converting uncompface's output in Lisp.
 
-  (unless gnus-article-xface-ring-internal ; Only load ring when needed.
-    (setq gnus-article-xface-ring-internal
-	  (make-ring gnus-article-xface-ring-size)))
-  (save-excursion
-    (let* ((cur (current-buffer))
-	   (data (buffer-substring beg end))
-	   (image (cdr-safe (assoc data (ring-elements
-					 gnus-article-xface-ring-internal)))))
-      (when (if (fboundp 'display-graphic-p)
-		(display-graphic-p))
+  (when (if (fboundp 'display-graphic-p)
+	    (display-graphic-p))
+    (unless gnus-article-xface-ring-internal ; Only load ring when needed.
+      (setq gnus-article-xface-ring-internal
+	    (make-ring gnus-article-xface-ring-size)))
+    (save-excursion
+      (let* ((cur (current-buffer))
+	     (data (buffer-substring beg end))
+	     (image (cdr-safe (assoc data (ring-elements
+					   gnus-article-xface-ring-internal))))
+	     default-enable-multibyte-characters)
 	(unless image
-	  (let ((coding-system-for-read 'binary)
-		(coding-system-for-write 'binary))
-	    (with-temp-buffer
-	      (insert data)
-	      (and (eq 0 (call-process-region (point-min) (point-max)
-					      "uncompface"
-					      'delete '(t nil)))
-		   (goto-char (point-min))
-		   (progn (insert "/* Width=48, Height=48 */\n") t)
-		   (eq 0 (call-process-region (point-min) (point-max)
-					      "icontopbm"
-					      'delete '(t nil)))
-		   ;; Miles Bader says that faces don't look right as
-		   ;; light on dark.
-		   (if (eq 'dark (cdr-safe (assq 'background-mode
-						 (frame-parameters))))
-		       (setq image (create-image (buffer-string) 'pbm t
-						 :ascent 'center
-						 :foreground "black"
-						 :background "white"))
+	  (with-temp-buffer
+	    (insert data)
+	    (and (eq 0 (call-process-region (point-min) (point-max)
+					    "uncompface"
+					    'delete '(t nil)))
+		 (goto-char (point-min))
+		 (progn (insert "/* Width=48, Height=48 */\n") t)
+		 (eq 0 (call-process-region (point-min) (point-max)
+					    "icontopbm"
+					    'delete '(t nil)))
+		 ;; Miles Bader says that faces don't look right as
+		 ;; light on dark.
+		 (if (eq 'dark (cdr-safe (assq 'background-mode
+					       (frame-parameters))))
 		     (setq image (create-image (buffer-string) 'pbm t
-					       :ascent 'center))))))
-	  (ring-insert gnus-article-xface-ring-internal (cons data image))))
-      (when image
-	(goto-char (point-min))
-	(re-search-forward "^From:" nil 'move)
-	(insert-image image)))))
+					       :ascent 'center
+					       :foreground "black"
+					       :background "white"))
+		   (setq image (create-image (buffer-string) 'pbm t
+					     :ascent 'center)))))
+	  (ring-insert gnus-article-xface-ring-internal (cons data image)))
+	(when image
+	  (goto-char (point-min))
+	  (re-search-forward "^From:" nil 'move)
+	  (insert-image image))))))
 
 (provide 'gnus-ems)