emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101273: gnus.el, gnus-html.el: Use t


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101273: gnus.el, gnus-html.el: Use the deleted text as the image alt text.
Date: Thu, 02 Sep 2010 00:03:57 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101273
author: Lars Magne Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Thu 2010-09-02 00:03:57 +0000
message:
  gnus.el, gnus-html.el: Use the deleted text as the image alt text.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/gnus-html.el
  lisp/gnus/gnus.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-09-01 23:53:57 +0000
+++ b/lisp/gnus/ChangeLog       2010-09-02 00:03:57 +0000
@@ -1,3 +1,11 @@
+2010-09-01  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * gnus-html.el (gnus-html-put-image): Use the deleted text as the image
+       alt text.
+
+       * gnus.el (gnus-string-or): Fix the syntax to not use eval or
+       overshadow variable bindings.
+
 2010-09-01  Teodor Zlatanov  <address@hidden>
 
        * gnus-html.el (gnus-html-wash-tags)

=== modified file 'lisp/gnus/gnus-html.el'
--- a/lisp/gnus/gnus-html.el    2010-09-01 23:53:57 +0000
+++ b/lisp/gnus/gnus-html.el    2010-09-02 00:03:57 +0000
@@ -132,17 +132,19 @@
                    (setq image (gnus-create-image (buffer-string)
                                                   nil t))))
                (when image
-                 (delete-region start end)
-                 (gnus-put-image image)))
+                 (let ((string (buffer-substring start end)))
+                   (delete-region start end)
+                   (gnus-put-image image (gnus-string-or string "*")))))
            ;; Normal, external URL.
            (when (or (null gnus-blocked-images)
                      (not (string-match gnus-blocked-images url)))
              (let ((file (gnus-html-image-id url)))
                (if (file-exists-p file)
                    ;; It's already cached, so just insert it.
-                   (when (gnus-html-put-image file (point))
+                   (let ((string (buffer-substring start end)))
                      ;; Delete the ALT text.
-                     (delete-region start end))
+                     (delete-region start end)
+                     (gnus-html-put-image file (point) string))
                  ;; We don't have it, so schedule it for fetching
                  ;; asynchronously.
                  (push (list url
@@ -209,13 +211,14 @@
                 ;; article before the image arrived.
                 (not (= (marker-position (cadr spec)) (point-min))))
        (with-current-buffer buffer
-         (let ((inhibit-read-only t))
-           (when (gnus-html-put-image file (cadr spec))
-             (delete-region (1+ (cadr spec)) (caddr spec))))))
+         (let ((inhibit-read-only t)
+               (string (buffer-substring (cadr spec) (caddr spec))))
+           (delete-region (cadr spec) (caddr spec))
+           (gnus-html-put-image file (cadr spec) string))))
       (when images
        (gnus-html-schedule-image-fetching buffer images)))))
 
-(defun gnus-html-put-image (file point)
+(defun gnus-html-put-image (file point string)
   (when (display-graphic-p)
     (let ((image (ignore-errors
                   (gnus-create-image file))))
@@ -229,11 +232,14 @@
                           (= (car (image-size image t)) 30)
                           (= (cdr (image-size image t)) 30))))
            (progn
-             (gnus-put-image (gnus-html-rescale-image image))
+             (gnus-put-image (gnus-html-rescale-image image)
+                             (gnus-string-or string "*"))
              t)
+         (insert string)
          (when (fboundp 'find-image)
            (gnus-put-image (find-image
-                            '((:type xpm :file "lock-broken.xpm")))))
+                            '((:type xpm :file "lock-broken.xpm")))
+                           (gnus-string-or string "*")))
          nil)))))
 
 (defun gnus-html-rescale-image (image)

=== modified file 'lisp/gnus/gnus.el'
--- a/lisp/gnus/gnus.el 2010-09-01 15:42:37 +0000
+++ b/lisp/gnus/gnus.el 2010-09-02 00:03:57 +0000
@@ -3289,12 +3289,12 @@
 (defmacro gnus-string-or (&rest strings)
   "Return the first element of STRINGS that is a non-blank string.
 STRINGS will be evaluated in normal `or' order."
-  `(gnus-string-or-1 ',strings))
+  `(gnus-string-or-1 (list ,@strings)))
 
 (defun gnus-string-or-1 (strings)
   (let (string)
     (while strings
-      (setq string (eval (pop strings)))
+      (setq string (pop strings))
       (if (string-match "^[ \t]*$" string)
          (setq string nil)
        (setq strings nil)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]