Commit f8d8a97b authored by Katsumi Yamaoka's avatar Katsumi Yamaoka
Browse files

shr.el (shr-image-displayer): Protect function against non-existent image source.

parent 40de2c6d
2010-11-17 Katsumi Yamaoka <yamaoka@jpl.org>
 
* shr.el (shr-image-displayer): Protect function against non-existent
image source.
* gnus-art.el (gnus-inhibit-images): New user option.
(gnus-mime-display-single): Don't display image if it is non-nil.
 
......
......@@ -441,19 +441,20 @@ CONTENT-FUNCTION is a function to retrieve an image for a cid url that
is an argument. The function to be returned takes three arguments URL,
START, and END."
`(lambda (url start end)
(if (string-match "\\`cid:" url)
,(when content-function
`(let ((image (funcall ,content-function
(substring url (match-end 0)))))
(when image
(goto-char start)
(shr-put-image image
(prog1
(buffer-substring-no-properties start end)
(delete-region start end))))))
(url-retrieve url 'shr-image-fetched
(list (current-buffer) start end)
t))))
(when url
(if (string-match "\\`cid:" url)
,(when content-function
`(let ((image (funcall ,content-function
(substring url (match-end 0)))))
(when image
(goto-char start)
(shr-put-image image
(prog1
(buffer-substring-no-properties start end)
(delete-region start end))))))
(url-retrieve url 'shr-image-fetched
(list (current-buffer) start end)
t)))))
(defun shr-heading (cont &rest types)
(shr-ensure-paragraph)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment