[gnus git] branch master updated: n0-13-48-gc5b0e32 =1= (gnus-import-other-newsrc-file): New function.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  c5b0e32708bb318800940824261c331cdc575dba (commit)
      from  38daba9dc05d445536890276dbff42063bde29d7 (commit)


- Log -----------------------------------------------------------------
commit c5b0e32708bb318800940824261c331cdc575dba
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Sun Feb 27 05:24:05 2011 +0100

    (gnus-import-other-newsrc-file): New function.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 44e06a8..1bebba7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-27  Lars Magne Ingebrigtsen  <[email protected]>
+
+	* gnus-group.el (gnus-import-other-newsrc-file): New function.
+
 2011-02-25  Teodor Zlatanov  <[email protected]>
 
 	* auth-source.el (auth-source-search): Cache empty result sets.
diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el
index 30cd127..832cd75 100644
--- a/lisp/gnus-group.el
+++ b/lisp/gnus-group.el
@@ -4400,6 +4400,21 @@ and the second element is the address."
 (defun gnus-group-set-params-info (group params)
   (gnus-group-set-info params group 'params))
 
+;; Ad-hoc function for inserting data from a different newsrc.eld
+;; file.  Use with caution, if at all.
+(defun gnus-import-other-newsrc-file (file)
+  (with-temp-buffer
+    (insert-file file)
+    (let (form)
+      (while (ignore-errors
+	       (setq form (read (current-buffer))))
+	(when (and (consp form)
+		   (eq (cadr form) 'gnus-newsrc-alist))
+	  (let ((infos (cadr (nth 2 form))))
+	    (dolist (info infos)
+	      (when (gnus-get-info (car info))
+		(gnus-set-info (car info) info)))))))))
+
 (defun gnus-add-marked-articles (group type articles &optional info force)
   ;; Add ARTICLES of TYPE to the info of GROUP.
   ;; If INFO is non-nil, use that info.  If FORCE is non-nil, don't
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 3b07074..b8d8874 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -3113,6 +3113,10 @@ Return nil if not defined."
 (defmacro gnus-get-info (group)
   `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
 
+(defun gnus-set-info (group info)
+  (setcar (nthcdr 2 (gnus-gethash group gnus-newsrc-hashtb))
+	  info))
+
 ;;; Load the compatibility functions.
 
 (require 'gnus-ems)

-----------------------------------------------------------------------
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     |    4 ++++
 lisp/gnus-group.el |   15 +++++++++++++++
 lisp/gnus.el       |    4 ++++
 3 files changed, 23 insertions(+), 0 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.