-(defun gnus-picons-article-display-x-face ()
- "Display the x-face header bitmap in the 'gnus-picons-display-where buffer."
- ;; delete any old ones.
- ;; This is needed here because gnus-picons-display-x-face will not
- ;; be called if there is no X-Face header
- (gnus-picons-remove 'gnus-x-face-annotations)
- ;; display the new one.
- (let ((gnus-article-x-face-command 'gnus-picons-display-x-face))
- (gnus-article-display-x-face)))
-
-(defun gnus-picons-x-face-sentinel (process event)
- (let* ((env (assq process gnus-picons-processes-alist))
- (annot (cdr env)))
- (setq gnus-picons-processes-alist
- (remassq process gnus-picons-processes-alist))
- (when (annotationp annot)
- (set-annotation-glyph annot
- (make-glyph gnus-picons-x-face-file-name))
- (if (memq annot gnus-x-face-annotations)
- (delete-file gnus-picons-x-face-file-name)))))
-
-(defun gnus-picons-display-x-face (beg end)
- "Function to display the x-face header in the picons window.
-To use: (setq gnus-article-x-face-command 'gnus-picons-display-x-face)"
- (interactive)
- (if (featurep 'xface)
- ;; Use builtin support
- (let ((buf (current-buffer)))
- (save-excursion
- (gnus-picons-prepare-for-annotations 'gnus-x-face-annotations)
- (setq gnus-x-face-annotations
- (cons (gnus-picons-make-annotation
- (vector 'xface
- :data (concat "X-Face: "
- (buffer-substring beg end buf)))
- nil 'text)
- gnus-x-face-annotations))))
- ;; convert the x-face header to a .xbm file
- (let* ((process-connection-type nil)
- (annot (save-excursion
- (gnus-picons-prepare-for-annotations
- 'gnus-x-face-annotations)
- (gnus-picons-make-annotation nil nil 'text)))
- (process (start-process-shell-command "gnus-x-face" nil
- gnus-picons-convert-x-face)))
- (push annot gnus-x-face-annotations)
- (push (cons process annot) gnus-picons-processes-alist)
- (process-kill-without-query process)
- (set-process-sentinel process 'gnus-picons-x-face-sentinel)
- (process-send-region process beg end)
- (process-send-eof process))))
-