[gnus git] branch master updated: n0-17-324-gebbd2fd =1= Support a new variable `shr-ignore-cache' to re-fetch images when hitting `g' in Gnus.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  ebbd2fd67aa7a7216e070a33f5d73d44b50bc9de (commit)
      from  29054f0fa0ecc9dac54ad2bba4736ea187c229a2 (commit)


- Log -----------------------------------------------------------------
commit ebbd2fd67aa7a7216e070a33f5d73d44b50bc9de
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Sat Sep 24 13:25:23 2011 +0200

    Support a new variable `shr-ignore-cache' to re-fetch images when hitting `g' in Gnus.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6845320..2e02c3c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2011-09-24  Lars Magne Ingebrigtsen  <[email protected]>
+
+	* 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  <[email protected]>
 
 	* mml.el (mml-inhibit-compute-boundary): New internal variable.
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 423de35..66b6618 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/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)
+    (require 'shr)
+    (let ((shr-ignore-cache t))
     ;; Select the article the normal way.
-    (gnus-summary-select-article nil 'force))
+      (gnus-summary-select-article nil 'force)))
    ((equal arg '(16))
     ;; C-u C-u g
     (let ((gnus-inhibit-article-treatments t))
diff --git a/lisp/shr.el b/lisp/shr.el
index 8faa507..fc2f577 100644
--- a/lisp/shr.el
+++ b/lisp/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

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |    8 ++++++++
 lisp/gnus-sum.el |    6 ++++--
 lisp/shr.el      |    9 ++++++++-
 3 files changed, 20 insertions(+), 3 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.