aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2012-02-18 22:28:00 +0000
committerKatsumi Yamaoka2012-02-18 22:28:00 +0000
commit0e2cebe57e75c570c7fcac25890ce995fbc7c598 (patch)
tree62fa2a43248be5012e7a6e88c50b419aac339604
parent37c3b9ee245f2568fb71de8306f820bd1bc18435 (diff)
downloademacs-0e2cebe57e75c570c7fcac25890ce995fbc7c598.tar.gz
emacs-0e2cebe57e75c570c7fcac25890ce995fbc7c598.zip
shr.el (shr-image-fetched): Be more defensive about killing the correct buffer
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/shr.el29
2 files changed, 20 insertions, 14 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 61f6ff9a3d3..d2f2b1b4660 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12012-02-18 Lars Ingebrigtsen <larsi@gnus.org>
2
3 * shr.el (shr-image-fetched): Make sure we really kill the right
4 buffer.
5
12012-02-16 Leo Liu <sdl.web@gmail.com> 62012-02-16 Leo Liu <sdl.web@gmail.com>
2 7
3 * gnus-start.el (gnus-1): Avoid duplicate entries. 8 * gnus-start.el (gnus-1): Avoid duplicate entries.
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index f3d75032926..dd0f1599c36 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -524,20 +524,21 @@ the URL of the image to the kill buffer instead."
524 directory))))) 524 directory)))))
525 525
526(defun shr-image-fetched (status buffer start end) 526(defun shr-image-fetched (status buffer start end)
527 (when (and (buffer-name buffer) 527 (let ((image-buffer (current-buffer)))
528 (not (plist-get status :error))) 528 (when (and (buffer-name buffer)
529 (url-store-in-cache (current-buffer)) 529 (not (plist-get status :error)))
530 (when (or (search-forward "\n\n" nil t) 530 (url-store-in-cache image-buffer)
531 (search-forward "\r\n\r\n" nil t)) 531 (when (or (search-forward "\n\n" nil t)
532 (let ((data (buffer-substring (point) (point-max)))) 532 (search-forward "\r\n\r\n" nil t))
533 (with-current-buffer buffer 533 (let ((data (buffer-substring (point) (point-max))))
534 (save-excursion 534 (with-current-buffer buffer
535 (let ((alt (buffer-substring start end)) 535 (save-excursion
536 (inhibit-read-only t)) 536 (let ((alt (buffer-substring start end))
537 (delete-region start end) 537 (inhibit-read-only t))
538 (goto-char start) 538 (delete-region start end)
539 (funcall shr-put-image-function data alt))))))) 539 (goto-char start)
540 (kill-buffer (current-buffer))) 540 (funcall shr-put-image-function data alt)))))))
541 (kill-buffer image-buffer)))
541 542
542(defun shr-put-image (data alt) 543(defun shr-put-image (data alt)
543 "Put image DATA with a string ALT. Return image." 544 "Put image DATA with a string ALT. Return image."