* gnus-art.el (article-display-x-face): Check whether valid grey
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 4 Jan 2002 04:48:02 +0000 (04:48 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Fri, 4 Jan 2002 04:48:02 +0000 (04:48 +0000)
face was returned.
(article-display-x-face): Place image in the right spot.

* gnus-fun.el (gnus-convert-gray-x-face-to-xpm): Get rid of
stderr.
(gnus-convert-gray-x-face-to-xpm): Check whether output is valid.

lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-fun.el

index 9851abb..fc5a4b3 100644 (file)
@@ -1,3 +1,13 @@
+2002-01-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-art.el (article-display-x-face): Check whether valid grey
+       face was returned.
+       (article-display-x-face): Place image in the right spot. 
+
+       * gnus-fun.el (gnus-convert-gray-x-face-to-xpm): Get rid of
+       stderr. 
+       (gnus-convert-gray-x-face-to-xpm): Check whether output is valid. 
+
 2002-01-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-xmas.el (gnus-xmas-create-image): Take optional
index 6674ce8..8d312e3 100644 (file)
@@ -1802,9 +1802,15 @@ unfolded."
              (push (mail-header-field-value) x-faces))
            (setq from (message-fetch-field "from"))))
        (if grey
-           (gnus-put-image
-            (gnus-create-image
-             (gnus-convert-gray-x-face-to-xpm x-faces) 'xpm t))
+           (let ((xpm (gnus-convert-gray-x-face-to-xpm x-faces))
+                 image)
+             (when xpm
+               (setq image (gnus-create-image xpm 'xpm t))
+               (goto-char (point-min))
+               (re-search-forward "^From:" nil 'move)
+               (gnus-add-wash-type 'xface)
+               (gnus-add-image 'xface image)
+               (gnus-put-image image)))
          ;; Sending multiple EOFs to xv doesn't work, so we only do a
          ;; single external face.
          (when (stringp gnus-article-x-face-command)
index c737b13..caae6ee 100644 (file)
 (defun gnus-convert-gray-x-face-to-xpm (faces)
   (let* ((depth (length faces))
         (scale (/ 255 (1- (expt 2 depth))))
+        (ok-p t)
         bit-list bit-lists pixels pixel)
     (dolist (face faces)
+      (setq bit-list nil)
       (with-temp-buffer
        (insert (uncompface face))
        (shell-command-on-region
         (point-min) (point-max)
-        "pnmnoraw"
+        "pnmnoraw 2>/dev/null"
         (current-buffer) t)
        (goto-char (point-min))
        (forward-line 2)
           ((eq (following-char) ?1)
            (push 1 bit-list)))
          (forward-char 1)))
+      (unless (= (length bit-list) (* 48 48))
+       (setq ok-p nil))
       (push bit-list bit-lists))
-    (dotimes (i (* 48 48))
-      (setq pixel 0)
-      (dotimes (plane depth)
-       (setq pixel (+ (* pixel 2) (nth i (nth plane bit-lists)))))
-      (push pixel pixels))
-    (with-temp-buffer
-      (insert "P2\n48 48\n255\n")
-      (dolist (pixel pixels)
-       (insert (number-to-string (* scale pixel)) " "))
-      (shell-command-on-region
-       (point-min) (point-max)
-       "ppmtoxpm 2>/dev/null"
-       (current-buffer) t)
-      (buffer-string))))
+    (when ok-p
+      (dotimes (i (* 48 48))
+       (setq pixel 0)
+       (dotimes (plane depth)
+         (setq pixel (+ (* pixel 2) (nth i (nth plane bit-lists)))))
+       (push pixel pixels))
+      (with-temp-buffer
+       (insert "P2\n48 48\n255\n")
+       (dolist (pixel pixels)
+         (insert (number-to-string (* scale pixel)) " "))
+       (shell-command-on-region
+        (point-min) (point-max)
+        "ppmtoxpm 2>/dev/null"
+        (current-buffer) t)
+       (buffer-string)))))
 
 ;;;###autoload
 (defun gnus-convert-gray-x-face-region (beg end)