(gnus-import-other-newsrc-file): New function.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 27 Feb 2011 04:24:05 +0000 (05:24 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 27 Feb 2011 04:24:05 +0000 (05:24 +0100)
lisp/ChangeLog
lisp/gnus-group.el
lisp/gnus.el

index 44e06a8..1bebba7 100644 (file)
@@ -1,3 +1,7 @@
+2011-02-27  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-group.el (gnus-import-other-newsrc-file): New function.
+
 2011-02-25  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * auth-source.el (auth-source-search): Cache empty result sets.
index 30cd127..832cd75 100644 (file)
@@ -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
index 3b07074..b8d8874 100644 (file)
@@ -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)