From 728518c3e476131e09848e44570709f81c7d8b09 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sat, 24 Sep 2011 23:09:56 +0000 Subject: [PATCH] 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. --- lisp/gnus/ChangeLog | 8 ++++++++ lisp/gnus/gnus-sum.el | 6 ++++-- lisp/gnus/shr.el | 9 ++++++++- 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 + + * 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 * 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 -- 2.39.5