emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107330: shr.el (shr-image-fetched):


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107330: shr.el (shr-image-fetched): Be more defensive about killing the correct buffer
Date: Sat, 18 Feb 2012 22:28:00 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107330
author: Lars Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Sat 2012-02-18 22:28:00 +0000
message:
  shr.el (shr-image-fetched): Be more defensive about killing the correct buffer
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/shr.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2012-02-16 14:33:58 +0000
+++ b/lisp/gnus/ChangeLog       2012-02-18 22:28:00 +0000
@@ -1,3 +1,8 @@
+2012-02-18  Lars Ingebrigtsen  <address@hidden>
+
+       * shr.el (shr-image-fetched): Make sure we really kill the right
+       buffer.
+
 2012-02-16  Leo Liu  <address@hidden>
 
        * gnus-start.el (gnus-1): Avoid duplicate entries.

=== modified file 'lisp/gnus/shr.el'
--- a/lisp/gnus/shr.el  2012-02-15 09:36:28 +0000
+++ b/lisp/gnus/shr.el  2012-02-18 22:28:00 +0000
@@ -524,20 +524,21 @@
                                      directory)))))
 
 (defun shr-image-fetched (status buffer start end)
-  (when (and (buffer-name buffer)
-            (not (plist-get status :error)))
-    (url-store-in-cache (current-buffer))
-    (when (or (search-forward "\n\n" nil t)
-             (search-forward "\r\n\r\n" nil t))
-      (let ((data (buffer-substring (point) (point-max))))
-        (with-current-buffer buffer
-         (save-excursion
-           (let ((alt (buffer-substring start end))
-                 (inhibit-read-only t))
-             (delete-region start end)
-             (goto-char start)
-             (funcall shr-put-image-function data alt)))))))
-  (kill-buffer (current-buffer)))
+  (let ((image-buffer (current-buffer)))
+    (when (and (buffer-name buffer)
+              (not (plist-get status :error)))
+      (url-store-in-cache image-buffer)
+      (when (or (search-forward "\n\n" nil t)
+               (search-forward "\r\n\r\n" nil t))
+       (let ((data (buffer-substring (point) (point-max))))
+         (with-current-buffer buffer
+           (save-excursion
+             (let ((alt (buffer-substring start end))
+                   (inhibit-read-only t))
+               (delete-region start end)
+               (goto-char start)
+               (funcall shr-put-image-function data alt)))))))
+    (kill-buffer image-buffer)))
 
 (defun shr-put-image (data alt)
   "Put image DATA with a string ALT.  Return image."


reply via email to

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