Mercurial > emacs
comparison lisp/gnus/gnus-html.el @ 111634:3334777d733d
Assume that gnus-inhibit-images may be a group parameter.
gnus-art.el (gnus-mime-display-single)
gnus-html.el (gnus-html-wash-images, gnus-html-prefetch-images)
mm-decode.el (mm-shr): Assume that gnus-inhibit-images may be a group parameter.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Fri, 19 Nov 2010 04:55:16 +0000 |
parents | c17f914efec2 |
children | b8f48ecba2e7 |
comparison
equal
deleted
inserted
replaced
111633:4e76c4e4f20f | 111634:3334777d733d |
---|---|
167 (while (re-search-forward "<a name[^\n>]+>" nil t) | 167 (while (re-search-forward "<a name[^\n>]+>" nil t) |
168 (replace-match "" t t))) | 168 (replace-match "" t t))) |
169 | 169 |
170 (defun gnus-html-wash-images () | 170 (defun gnus-html-wash-images () |
171 "Run through current buffer and replace img tags by images." | 171 "Run through current buffer and replace img tags by images." |
172 (let (tag parameters string start end images url alt-text) | 172 (let (tag parameters string start end images url alt-text |
173 inhibit-images blocked-images) | |
174 (if (buffer-live-p gnus-summary-buffer) | |
175 (with-current-buffer gnus-summary-buffer | |
176 (setq inhibit-images gnus-inhibit-images | |
177 blocked-images (gnus-blocked-images))) | |
178 (setq inhibit-images gnus-inhibit-images | |
179 blocked-images (gnus-blocked-images))) | |
173 (goto-char (point-min)) | 180 (goto-char (point-min)) |
174 ;; Search for all the images first. | 181 ;; Search for all the images first. |
175 (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t) | 182 (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t) |
176 (setq parameters (match-string 1) | 183 (setq parameters (match-string 1) |
177 start (match-beginning 0)) | 184 start (match-beginning 0)) |
198 ;; URLs with cid: have their content stashed in other | 205 ;; URLs with cid: have their content stashed in other |
199 ;; parts of the MIME structure, so just insert them | 206 ;; parts of the MIME structure, so just insert them |
200 ;; immediately. | 207 ;; immediately. |
201 (let* ((handle (mm-get-content-id (substring url (match-end 0)))) | 208 (let* ((handle (mm-get-content-id (substring url (match-end 0)))) |
202 (image (when (and handle | 209 (image (when (and handle |
203 (not gnus-inhibit-images)) | 210 (not inhibit-images)) |
204 (gnus-create-image | 211 (gnus-create-image |
205 (mm-with-part handle (buffer-string)) | 212 (mm-with-part handle (buffer-string)) |
206 nil t)))) | 213 nil t)))) |
207 (if image | 214 (if image |
208 (progn | 215 (progn |
220 :action 'gnus-html-insert-image | 227 :action 'gnus-html-insert-image |
221 :help-echo url | 228 :help-echo url |
222 :keymap gnus-html-image-map | 229 :keymap gnus-html-image-map |
223 :button-keymap gnus-html-image-map))) | 230 :button-keymap gnus-html-image-map))) |
224 ;; Normal, external URL. | 231 ;; Normal, external URL. |
225 (if (or gnus-inhibit-images | 232 (if (or inhibit-images |
226 (gnus-html-image-url-blocked-p | 233 (gnus-html-image-url-blocked-p url blocked-images)) |
227 url | |
228 (if (buffer-live-p gnus-summary-buffer) | |
229 (with-current-buffer gnus-summary-buffer | |
230 (gnus-blocked-images)) | |
231 (gnus-blocked-images)))) | |
232 (widget-convert-button | 234 (widget-convert-button |
233 'link start end | 235 'link start end |
234 :action 'gnus-html-insert-image | 236 :action 'gnus-html-insert-image |
235 :help-echo url | 237 :help-echo url |
236 :keymap gnus-html-image-map | 238 :keymap gnus-html-image-map |
503 ret)) | 505 ret)) |
504 | 506 |
505 ;;;###autoload | 507 ;;;###autoload |
506 (defun gnus-html-prefetch-images (summary) | 508 (defun gnus-html-prefetch-images (summary) |
507 (when (buffer-live-p summary) | 509 (when (buffer-live-p summary) |
508 (let ((blocked-images (with-current-buffer summary | 510 (let (inhibit-images blocked-images) |
509 (gnus-blocked-images)))) | 511 (with-current-buffer summary-buffer |
512 (setq inhibit-images gnus-inhibit-images | |
513 blocked-images (gnus-blocked-images))) | |
510 (save-match-data | 514 (save-match-data |
511 (while (re-search-forward "<img[^>]+src=[\"']\\(http[^\"']+\\)" nil t) | 515 (while (re-search-forward "<img[^>]+src=[\"']\\(http[^\"']+\\)" nil t) |
512 (let ((url (gnus-html-encode-url | 516 (let ((url (gnus-html-encode-url |
513 (mm-url-decode-entities-string (match-string 1))))) | 517 (mm-url-decode-entities-string (match-string 1))))) |
514 (unless (or gnus-inhibit-images | 518 (unless (or inhibit-images |
515 (gnus-html-image-url-blocked-p url blocked-images)) | 519 (gnus-html-image-url-blocked-p url blocked-images)) |
516 (when (gnus-html-cache-expired url gnus-html-image-cache-ttl) | 520 (when (gnus-html-cache-expired url gnus-html-image-cache-ttl) |
517 (gnus-html-schedule-image-fetching nil | 521 (gnus-html-schedule-image-fetching nil |
518 (list url)))))))))) | 522 (list url)))))))))) |
519 | 523 |