[gnus git] branch master updated: n0-17-8-gc54fbb1 =1= Store articles in the agent if we haven't already (bug#8502).

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  c54fbb1765b68ae57af94d52f83a38f6404bedb2 (commit)
      from  9856b95426267b9eff45156d5cd9aa3a25fcf9eb (commit)


- Log -----------------------------------------------------------------
commit c54fbb1765b68ae57af94d52f83a38f6404bedb2
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Mon May 2 16:21:31 2011 +0200

    Store articles in the agent if we haven't already (bug#8502).

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index deae452..d6ae172 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,15 @@
 2011-05-02  Lars Magne Ingebrigtsen  <[email protected]>
 
+	* gnus.el: Autoload more gnus-agent functions.
+
+	* gnus-art.el (gnus-request-article-this-buffer): Store articles in the
+	agent if we haven't already (bug#8502).
+
+	* gnus-async.el (gnus-async-article-callback): Put prefetched articles
+	into the Agent, too.
+
+	* gnus-agent.el (gnus-agent-store-article): New function.
+
 	* nnheader.el (nnheader-insert-buffer-substring): Renamed from nntp-
 	and moved from that file for reuse.
 
diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el
index 52fbe9d..b4f0dc3 100644
--- a/lisp/gnus-agent.el
+++ b/lisp/gnus-agent.el
@@ -3876,6 +3876,15 @@ has been fetched."
           (insert-file-contents file))
         t))))
 
+(defun gnus-agent-store-article (article group)
+  (let* ((gnus-command-method (gnus-find-method-for-group group))
+	 (file (gnus-agent-article-name (number-to-string article) group))
+	 (file-name-coding-system nnmail-pathname-coding-system)
+	 (coding-system-for-write gnus-cache-coding-system))
+    (when (not (file-exists-p file))
+      (gnus-make-directory (file-name-directory file))
+      (write-region (point-min) (point-max) file nil 'silent))))
+
 (defun gnus-agent-regenerate-group (group &optional reread)
   "Regenerate GROUP.
 If REREAD is t, all articles in the .overview are marked as unread.
diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el
index e03c787..690e29c 100644
--- a/lisp/gnus-art.el
+++ b/lisp/gnus-art.el
@@ -6841,7 +6841,10 @@ If given a prefix, show the hidden text instead."
 					      gnus-summary-buffer)
 		    (when gnus-keep-backlog
 		      (gnus-backlog-enter-article
-		       group article (current-buffer))))
+		       group article (current-buffer)))
+		    (when (and gnus-agent
+			       (gnus-agent-group-covered-p group))
+		      (gnus-agent-store-article article group)))
 		  (setq result 'article))
 		 (methods
 		  (setq gnus-override-method (pop methods)))
diff --git a/lisp/gnus-async.el b/lisp/gnus-async.el
index b7e24b8..ad85bc5 100644
--- a/lisp/gnus-async.el
+++ b/lisp/gnus-async.el
@@ -237,6 +237,12 @@ that was fetched."
       (save-excursion
 	(save-restriction
 	  (narrow-to-region mark (point-max))
+	  ;; Put the articles into the agent, if they aren't already.
+	  (when (and gnus-agent
+		     (gnus-agent-group-covered-p group))
+	    (save-restriction
+	      (narrow-to-region mark (point-max))
+	      (gnus-agent-store-article article group)))
 	  ;; Prefetch images for the groups that want that.
 	  (when (fboundp 'gnus-html-prefetch-images)
 	    (gnus-html-prefetch-images summary))
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 3707454..8cd2f06 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -2909,7 +2909,8 @@ gnus-registry.el will populate this if it's loaded.")
       gnus-agent-save-active gnus-agent-method-p
       gnus-agent-get-undownloaded-list gnus-agent-fetch-session
       gnus-summary-set-agent-mark gnus-agent-save-group-info
-      gnus-agent-request-article gnus-agent-retrieve-headers)
+      gnus-agent-request-article gnus-agent-retrieve-headers
+      gnus-agent-store-article gnus-agent-group-covered-p)
      ("gnus-agent" :interactive t
       gnus-unplugged gnus-agentize gnus-agent-batch)
      ("gnus-vm" :interactive t gnus-summary-save-in-vm

-----------------------------------------------------------------------
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     |   10 ++++++++++
 lisp/gnus-agent.el |    9 +++++++++
 lisp/gnus-art.el   |    5 ++++-
 lisp/gnus-async.el |    6 ++++++
 lisp/gnus.el       |    3 ++-
 5 files changed, 31 insertions(+), 2 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.