comparison lisp/gnus/gnus-art.el @ 63906:6e92df884ee6

Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-464 Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 87) - Update from CVS 2005-07-01 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (article-display-face): Improve the efficiency. (article-display-x-face): Ditto; remove grey x-face stuff.
author Miles Bader <miles@gnu.org>
date Sat, 02 Jul 2005 02:53:20 +0000
parents cf8b4d09b958
children 18a818a2ee7c
comparison
equal deleted inserted replaced
63905:15a0b97b4797 63906:6e92df884ee6
2121 ;; D d' would have). So face deletion must occur only when we come from 2121 ;; D d' would have). So face deletion must occur only when we come from
2122 ;; an interactive command, that is when the *Article* buffer is 2122 ;; an interactive command, that is when the *Article* buffer is
2123 ;; read-only. 2123 ;; read-only.
2124 (if (and wash-face-p (memq 'face gnus-article-wash-types)) 2124 (if (and wash-face-p (memq 'face gnus-article-wash-types))
2125 (gnus-delete-images 'face) 2125 (gnus-delete-images 'face)
2126 (let ((from (gnus-article-goto-header "from")) 2126 (let (face faces from)
2127 face faces) 2127 (save-current-buffer
2128 (save-excursion
2129 (when (and wash-face-p 2128 (when (and wash-face-p
2130 (progn 2129 (gnus-buffer-live-p gnus-original-article-buffer)
2131 (goto-char (point-min)) 2130 (not (re-search-forward "^Face:[\t ]*" nil t)))
2132 (not (re-search-forward "^Face:[\t ]*" nil t)))
2133 (gnus-buffer-live-p gnus-original-article-buffer))
2134 (set-buffer gnus-original-article-buffer)) 2131 (set-buffer gnus-original-article-buffer))
2135 (save-restriction 2132 (save-restriction
2136 (mail-narrow-to-head) 2133 (mail-narrow-to-head)
2137 (while (gnus-article-goto-header "Face") 2134 (while (gnus-article-goto-header "Face")
2138 (push (mail-header-field-value) faces)))) 2135 (push (mail-header-field-value) faces))))
2139 (when faces 2136 (when faces
2140 (unless from 2137 (goto-char (point-min))
2141 (insert "From:") 2138 (let ((from (gnus-article-goto-header "from"))
2142 (setq from (point)) 2139 png image)
2143 (insert "[no `from' set]\n")) 2140 (unless from
2144 (dolist (face faces) 2141 (insert "From:")
2145 (let ((png (gnus-convert-face-to-png face)) 2142 (setq from (point))
2146 image) 2143 (insert "[no `from' set]\n"))
2147 (when png 2144 (while faces
2145 (when (setq png (gnus-convert-face-to-png (pop faces)))
2148 (setq image (gnus-create-image png 'png t)) 2146 (setq image (gnus-create-image png 'png t))
2149 (goto-char from) 2147 (goto-char from)
2150 (gnus-add-wash-type 'face) 2148 (gnus-add-wash-type 'face)
2151 (gnus-add-image 'face image) 2149 (gnus-add-image 'face image)
2152 (gnus-put-image image nil 'face)))))))))) 2150 (gnus-put-image image nil 'face))))))))))
2164 ;; We have already displayed X-Faces, so we remove them 2162 ;; We have already displayed X-Faces, so we remove them
2165 ;; instead. 2163 ;; instead.
2166 (gnus-delete-images 'xface) 2164 (gnus-delete-images 'xface)
2167 ;; Display X-Faces. 2165 ;; Display X-Faces.
2168 (let (x-faces from face) 2166 (let (x-faces from face)
2169 (save-excursion 2167 (save-current-buffer
2170 (when (and wash-face-p 2168 (when (and wash-face-p
2171 (progn 2169 (gnus-buffer-live-p gnus-original-article-buffer)
2172 (goto-char (point-min)) 2170 (not (re-search-forward "^X-Face:[\t ]*" nil t)))
2173 (not (re-search-forward
2174 "^X-Face\\(-[0-9]+\\)?:[\t ]*" nil t)))
2175 (gnus-buffer-live-p gnus-original-article-buffer))
2176 ;; If type `W f', use gnus-original-article-buffer, 2171 ;; If type `W f', use gnus-original-article-buffer,
2177 ;; otherwise use the current buffer because displaying 2172 ;; otherwise use the current buffer because displaying
2178 ;; RFC822 parts calls this function too. 2173 ;; RFC822 parts calls this function too.
2179 (set-buffer gnus-original-article-buffer)) 2174 (set-buffer gnus-original-article-buffer))
2180 (save-restriction 2175 (save-restriction
2184 (setq from (message-fetch-field "from")))) 2179 (setq from (message-fetch-field "from"))))
2185 ;; Sending multiple EOFs to xv doesn't work, so we only do a 2180 ;; Sending multiple EOFs to xv doesn't work, so we only do a
2186 ;; single external face. 2181 ;; single external face.
2187 (when (stringp gnus-article-x-face-command) 2182 (when (stringp gnus-article-x-face-command)
2188 (setq x-faces (list (car x-faces)))) 2183 (setq x-faces (list (car x-faces))))
2189 (while (and (setq face (pop x-faces)) 2184 (when (and x-faces
2190 gnus-article-x-face-command 2185 gnus-article-x-face-command
2191 (or force 2186 (or force
2192 ;; Check whether this face is censored. 2187 ;; Check whether this face is censored.
2193 (not gnus-article-x-face-too-ugly) 2188 (not gnus-article-x-face-too-ugly)
2194 (and gnus-article-x-face-too-ugly from 2189 (and from
2195 (not (string-match gnus-article-x-face-too-ugly 2190 (not (string-match gnus-article-x-face-too-ugly
2196 from))))) 2191 from)))))
2197 ;; We display the face. 2192 (while (setq face (pop x-faces))
2198 (cond ((stringp gnus-article-x-face-command) 2193 ;; We display the face.
2199 ;; The command is a string, so we interpret the command 2194 (cond ((stringp gnus-article-x-face-command)
2200 ;; as a, well, command, and fork it off. 2195 ;; The command is a string, so we interpret the command
2201 (let ((process-connection-type nil)) 2196 ;; as a, well, command, and fork it off.
2202 (gnus-set-process-query-on-exit-flag 2197 (let ((process-connection-type nil))
2203 (start-process 2198 (gnus-set-process-query-on-exit-flag
2204 "article-x-face" nil shell-file-name 2199 (start-process
2205 shell-command-switch gnus-article-x-face-command) 2200 "article-x-face" nil shell-file-name
2206 nil) 2201 shell-command-switch gnus-article-x-face-command)
2207 (with-temp-buffer 2202 nil)
2208 (insert face) 2203 (with-temp-buffer
2209 (process-send-region "article-x-face" 2204 (insert face)
2210 (point-min) (point-max))) 2205 (process-send-region "article-x-face"
2211 (process-send-eof "article-x-face"))) 2206 (point-min) (point-max)))
2212 ((functionp gnus-article-x-face-command) 2207 (process-send-eof "article-x-face")))
2213 ;; The command is a lisp function, so we call it. 2208 ((functionp gnus-article-x-face-command)
2214 (funcall gnus-article-x-face-command face)) 2209 ;; The command is a lisp function, so we call it.
2215 (t 2210 (funcall gnus-article-x-face-command face))
2216 (error "%s is not a function" 2211 (t
2217 gnus-article-x-face-command))))))))) 2212 (error "%s is not a function"
2213 gnus-article-x-face-command))))))))))
2218 2214
2219 (defun article-decode-mime-words () 2215 (defun article-decode-mime-words ()
2220 "Decode all MIME-encoded words in the article." 2216 "Decode all MIME-encoded words in the article."
2221 (interactive) 2217 (interactive)
2222 (save-excursion 2218 (save-excursion