aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/gnus/gnus-html.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-09-04 00:21:34 +0000
committerKatsumi Yamaoka2010-09-04 00:21:34 +0000
commit10e91ca9826f03156ac027ba111a052d888eacf0 (patch)
tree9863e7ee1ea90e8878e739fe31b2f7b2b3ead0b7 /lisp/gnus/gnus-html.el
parent7426b4f7d05884c2f4677d825a4e6a3509e1eb5a (diff)
downloademacs-10e91ca9826f03156ac027ba111a052d888eacf0.tar.gz
emacs-10e91ca9826f03156ac027ba111a052d888eacf0.zip
gnus-agent.el: Change the default so that nnimap methods aren't agentized by default. There's apparently many problems related to agent/imap behaviour; gnus-art.el: Don't reuse the 'gnus-data text property, but use a new property. This avoids stomping over other functions that use this for other things; gnus-html.el: Add a new `i' command to insert images.
Diffstat (limited to 'lisp/gnus/gnus-html.el')
-rw-r--r--lisp/gnus/gnus-html.el41
1 files changed, 34 insertions, 7 deletions
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index 6687415ec16..4c0d4c0664f 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -66,6 +66,12 @@ fit these criteria."
66 :group 'gnus-art 66 :group 'gnus-art
67 :type 'float) 67 :type 'float)
68 68
69(defvar gnus-html-image-map
70 (let ((map (make-sparse-keymap)))
71 (define-key map "u" 'gnus-article-copy-string)
72 (define-key map "i" 'gnus-html-insert-image)
73 map))
74
69;;;###autoload 75;;;###autoload
70(defun gnus-article-html (handle) 76(defun gnus-article-html (handle)
71 (let ((article-buffer (current-buffer))) 77 (let ((article-buffer (current-buffer)))
@@ -142,12 +148,24 @@ fit these criteria."
142 (delete-region start end) 148 (delete-region start end)
143 (gnus-put-image image (gnus-string-or string "*"))))) 149 (gnus-put-image image (gnus-string-or string "*")))))
144 ;; Normal, external URL. 150 ;; Normal, external URL.
145 (unless (gnus-html-image-url-blocked-p 151 (if (gnus-html-image-url-blocked-p
146 url 152 url
147 (if (buffer-live-p gnus-summary-buffer) 153 (if (buffer-live-p gnus-summary-buffer)
148 (with-current-buffer gnus-summary-buffer 154 (with-current-buffer gnus-summary-buffer
149 gnus-blocked-images) 155 gnus-blocked-images)
150 gnus-blocked-images)) 156 gnus-blocked-images))
157 (progn
158 (widget-convert-button
159 'link start end
160 :action 'gnus-html-insert-image
161 :help-echo url
162 :keymap gnus-html-image-map
163 :button-keymap gnus-html-image-map)
164 (gnus-put-text-property
165 start end
166 'gnus-image (list url
167 (set-marker (make-marker) start)
168 (set-marker (make-marker) end))))
151 (let ((file (gnus-html-image-id url)) 169 (let ((file (gnus-html-image-id url))
152 width height) 170 width height)
153 (when (string-match "height=\"?\\([0-9]+\\)" parameters) 171 (when (string-match "height=\"?\\([0-9]+\\)" parameters)
@@ -184,6 +202,7 @@ fit these criteria."
184 (let ((overlay (gnus-make-overlay start end))) 202 (let ((overlay (gnus-make-overlay start end)))
185 (gnus-overlay-put overlay 'evaporate t) 203 (gnus-overlay-put overlay 'evaporate t)
186 (gnus-overlay-put overlay 'gnus-button-url url) 204 (gnus-overlay-put overlay 'gnus-button-url url)
205 (gnus-put-text-property start end 'gnus-string url)
187 (when gnus-article-mouse-face 206 (when gnus-article-mouse-face
188 (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face))))) 207 (gnus-overlay-put overlay 'mouse-face gnus-article-mouse-face)))))
189 ;; The upper-case IMG_ALT is apparently just an artifact that 208 ;; The upper-case IMG_ALT is apparently just an artifact that
@@ -202,6 +221,12 @@ fit these criteria."
202 (when images 221 (when images
203 (gnus-html-schedule-image-fetching (current-buffer) (nreverse images))))) 222 (gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))))
204 223
224(defun gnus-html-insert-image ()
225 "Fetch and insert the image under point."
226 (interactive)
227 (gnus-html-schedule-image-fetching
228 (current-buffer) (list (get-text-property (point) 'gnus-image))))
229
205(defun gnus-html-schedule-image-fetching (buffer images) 230(defun gnus-html-schedule-image-fetching (buffer images)
206 (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s" 231 (gnus-message 8 "gnus-html-schedule-image-fetching: buffer %s, images %s"
207 buffer images) 232 buffer images)
@@ -268,7 +293,9 @@ fit these criteria."
268 (= (cdr size) 30)))) 293 (= (cdr size) 30))))
269 (progn 294 (progn
270 (gnus-put-image (gnus-html-rescale-image image file size) 295 (gnus-put-image (gnus-html-rescale-image image file size)
271 (gnus-string-or string "*")) 296 (gnus-string-or string "*")
297 'external)
298 (gnus-add-image 'external image)
272 t) 299 t)
273 (insert string) 300 (insert string)
274 (when (fboundp 'find-image) 301 (when (fboundp 'find-image)