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-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
(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)
(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)