aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-09-02 00:03:57 +0000
committerKatsumi Yamaoka2010-09-02 00:03:57 +0000
commit075843d346ec303963e065a8fe61a98a4210dc16 (patch)
tree46bb908926b5f175411b28c11e1fabb654eb56a4
parent59d09f15ac0485d4f1818459926c95f560f28999 (diff)
downloademacs-075843d346ec303963e065a8fe61a98a4210dc16.tar.gz
emacs-075843d346ec303963e065a8fe61a98a4210dc16.zip
gnus.el, gnus-html.el: Use the deleted text as the image alt text.
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/gnus-html.el26
-rw-r--r--lisp/gnus/gnus.el4
3 files changed, 26 insertions, 12 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 711e7194d39..b85a4ce1c93 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,11 @@
12010-09-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * gnus-html.el (gnus-html-put-image): Use the deleted text as the image
4 alt text.
5
6 * gnus.el (gnus-string-or): Fix the syntax to not use eval or
7 overshadow variable bindings.
8
12010-09-01 Teodor Zlatanov <tzz@lifelogs.com> 92010-09-01 Teodor Zlatanov <tzz@lifelogs.com>
2 10
3 * gnus-html.el (gnus-html-wash-tags) 11 * gnus-html.el (gnus-html-wash-tags)
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index a89a3f57ff1..b6b4c507825 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -132,17 +132,19 @@ fit these criteria."
132 (setq image (gnus-create-image (buffer-string) 132 (setq image (gnus-create-image (buffer-string)
133 nil t)))) 133 nil t))))
134 (when image 134 (when image
135 (delete-region start end) 135 (let ((string (buffer-substring start end)))
136 (gnus-put-image image))) 136 (delete-region start end)
137 (gnus-put-image image (gnus-string-or string "*")))))
137 ;; Normal, external URL. 138 ;; Normal, external URL.
138 (when (or (null gnus-blocked-images) 139 (when (or (null gnus-blocked-images)
139 (not (string-match gnus-blocked-images url))) 140 (not (string-match gnus-blocked-images url)))
140 (let ((file (gnus-html-image-id url))) 141 (let ((file (gnus-html-image-id url)))
141 (if (file-exists-p file) 142 (if (file-exists-p file)
142 ;; It's already cached, so just insert it. 143 ;; It's already cached, so just insert it.
143 (when (gnus-html-put-image file (point)) 144 (let ((string (buffer-substring start end)))
144 ;; Delete the ALT text. 145 ;; Delete the ALT text.
145 (delete-region start end)) 146 (delete-region start end)
147 (gnus-html-put-image file (point) string))
146 ;; We don't have it, so schedule it for fetching 148 ;; We don't have it, so schedule it for fetching
147 ;; asynchronously. 149 ;; asynchronously.
148 (push (list url 150 (push (list url
@@ -209,13 +211,14 @@ fit these criteria."
209 ;; article before the image arrived. 211 ;; article before the image arrived.
210 (not (= (marker-position (cadr spec)) (point-min)))) 212 (not (= (marker-position (cadr spec)) (point-min))))
211 (with-current-buffer buffer 213 (with-current-buffer buffer
212 (let ((inhibit-read-only t)) 214 (let ((inhibit-read-only t)
213 (when (gnus-html-put-image file (cadr spec)) 215 (string (buffer-substring (cadr spec) (caddr spec))))
214 (delete-region (1+ (cadr spec)) (caddr spec)))))) 216 (delete-region (cadr spec) (caddr spec))
217 (gnus-html-put-image file (cadr spec) string))))
215 (when images 218 (when images
216 (gnus-html-schedule-image-fetching buffer images))))) 219 (gnus-html-schedule-image-fetching buffer images)))))
217 220
218(defun gnus-html-put-image (file point) 221(defun gnus-html-put-image (file point string)
219 (when (display-graphic-p) 222 (when (display-graphic-p)
220 (let ((image (ignore-errors 223 (let ((image (ignore-errors
221 (gnus-create-image file)))) 224 (gnus-create-image file))))
@@ -229,11 +232,14 @@ fit these criteria."
229 (= (car (image-size image t)) 30) 232 (= (car (image-size image t)) 30)
230 (= (cdr (image-size image t)) 30)))) 233 (= (cdr (image-size image t)) 30))))
231 (progn 234 (progn
232 (gnus-put-image (gnus-html-rescale-image image)) 235 (gnus-put-image (gnus-html-rescale-image image)
236 (gnus-string-or string "*"))
233 t) 237 t)
238 (insert string)
234 (when (fboundp 'find-image) 239 (when (fboundp 'find-image)
235 (gnus-put-image (find-image 240 (gnus-put-image (find-image
236 '((:type xpm :file "lock-broken.xpm"))))) 241 '((:type xpm :file "lock-broken.xpm")))
242 (gnus-string-or string "*")))
237 nil))))) 243 nil)))))
238 244
239(defun gnus-html-rescale-image (image) 245(defun gnus-html-rescale-image (image)
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index b3752506c8f..25c1bc44296 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -3289,12 +3289,12 @@ with a `subscribed' parameter."
3289(defmacro gnus-string-or (&rest strings) 3289(defmacro gnus-string-or (&rest strings)
3290 "Return the first element of STRINGS that is a non-blank string. 3290 "Return the first element of STRINGS that is a non-blank string.
3291STRINGS will be evaluated in normal `or' order." 3291STRINGS will be evaluated in normal `or' order."
3292 `(gnus-string-or-1 ',strings)) 3292 `(gnus-string-or-1 (list ,@strings)))
3293 3293
3294(defun gnus-string-or-1 (strings) 3294(defun gnus-string-or-1 (strings)
3295 (let (string) 3295 (let (string)
3296 (while strings 3296 (while strings
3297 (setq string (eval (pop strings))) 3297 (setq string (pop strings))
3298 (if (string-match "^[ \t]*$" string) 3298 (if (string-match "^[ \t]*$" string)
3299 (setq string nil) 3299 (setq string nil)
3300 (setq strings nil))) 3300 (setq strings nil)))