summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2011-09-24 23:09:56 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2011-09-24 23:09:56 +0000
commit728518c3e476131e09848e44570709f81c7d8b09 (patch)
treeae6ad52378c1002f64410ae0663fb3867652ded3
parentb02ba905b4a8b0b95b858639db8bd6632a9fe57f (diff)
downloademacs-728518c3e476131e09848e44570709f81c7d8b09.tar.gz
Support a new variable `shr-ignore-cache' to re-fetch images when hitting `g' in Gnus.
gnus-sum.el (gnus-summary-show-article): Bind `shr-ignore-cache' to re-fetch images. shr.el (shr-tag-img): Support a new variable `shr-ignore-cache' to re-fetch images when hitting `g' in Gnus.
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/gnus-sum.el6
-rw-r--r--lisp/gnus/shr.el9
3 files changed, 20 insertions, 3 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index fa97128634b..2cd76486bd7 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-24 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * gnus-sum.el (gnus-summary-show-article): Bind `shr-ignore-cache' to
+ re-fetch images.
+
+ * shr.el (shr-tag-img): Support a new variable `shr-ignore-cache' to
+ re-fetch images when hitting `g' in Gnus.
+
2011-09-22 Katsumi Yamaoka <yamaoka@jpl.org>
* mml.el (mml-inhibit-compute-boundary): New internal variable.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 423de352453..66b661884e9 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9611,8 +9611,10 @@ C-u g', show the raw article."
(when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
(gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
((not arg)
- ;; Select the article the normal way.
- (gnus-summary-select-article nil 'force))
+ (require 'shr)
+ (let ((shr-ignore-cache t))
+ ;; Select the article the normal way.
+ (gnus-summary-select-article nil 'force)))
((equal arg '(16))
;; C-u C-u g
(let ((gnus-inhibit-article-treatments t))
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 8faa5071616..fc2f5777fb7 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -112,6 +112,7 @@ cid: URL as the argument.")
(defvar shr-table-depth 0)
(defvar shr-stylesheet nil)
(defvar shr-base nil)
+(defvar shr-ignore-cache nil)
(defvar shr-map
(let ((map (make-sparse-keymap)))
@@ -896,10 +897,16 @@ ones, in case fg and bg are nil."
(if (> (string-width alt) 8)
(shr-insert (truncate-string-to-width alt 8))
(shr-insert alt))))
- ((url-is-cached (shr-encode-url url))
+ ((and (not shr-ignore-cache)
+ (url-is-cached (shr-encode-url url)))
(funcall shr-put-image-function (shr-get-image-data url) alt))
(t
(insert alt)
+ (when (and shr-ignore-cache
+ (url-is-cached (shr-encode-url url)))
+ (let ((file (url-cache-create-filename (shr-encode-url url))))
+ (when (file-exists-p file)
+ (delete-file file))))
(funcall
(if (fboundp 'url-queue-retrieve)
'url-queue-retrieve