From: Lars Ingebrigtsen Date: Sun, 27 Feb 2011 08:20:21 +0000 (+0000) Subject: gnus-group.el (gnus-import-other-newsrc-file): New function. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~714 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=85e75dedc0c45d92a2c03357433cfeb414fd7dc6;p=emacs.git gnus-group.el (gnus-import-other-newsrc-file): New function. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 3eb7a477dd1..d0660545844 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2011-02-27 Lars Magne Ingebrigtsen + + * gnus-group.el (gnus-import-other-newsrc-file): New function. + 2011-02-25 Teodor Zlatanov * auth-source.el (auth-source-search): Cache empty result sets. diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 30cd1275e7b..832cd758b61 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/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/gnus.el b/lisp/gnus/gnus.el index 42acb65ff9f..a5c727925f6 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -3114,6 +3114,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)