X-Git-Url: https://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-move.el;h=801f891b8a0bd85b4ec645f65596fcb1c3662f4e;hb=4b34fded7033b14cbfcf3dc0db672c72acde7acb;hp=ba8b9c252c3206b67bad996d0f4bcba5cc0d7d2b;hpb=b28454eed83f245c4160228b076134ce930b320a;p=gnus diff --git a/lisp/gnus-move.el b/lisp/gnus-move.el index ba8b9c252..801f891b8 100644 --- a/lisp/gnus-move.el +++ b/lisp/gnus-move.el @@ -25,6 +25,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) + (require 'gnus) (require 'gnus-start) (require 'gnus-int) @@ -59,15 +61,18 @@ Update the .newsrc.eld file to reflect the change of nntp server." "Move group INFO from FROM-SERVER to TO-SERVER." (let ((group (gnus-info-group info)) to-active hashtb type mark marks - to-article to-reads to-marks article) + to-article to-reads to-marks article + act-articles) (gnus-message 7 "Translating %s..." group) (when (gnus-request-group group nil to-server) (setq to-active (gnus-parse-active) - hashtb (gnus-make-hashtable 1024)) + hashtb (gnus-make-hashtable 1024) + act-articles (gnus-uncompress-range to-active)) ;; Fetch the headers from the `to-server'. (when (and to-active + act-articles (setq type (gnus-retrieve-headers - (gnus-uncompress-range to-active) + act-articles group to-server))) ;; Convert HEAD headers. I don't care. (when (eq type 'headers) @@ -108,24 +113,24 @@ Update the .newsrc.eld file to reflect the change of nntp server." (goto-char (point-min)) (while (looking-at "^[0-9]+\t[^\t]*\t[^\t]*\t[^\t]*\t\\([^\t]*\\)\t") - (setq to-article - (gnus-gethash - (buffer-substring (match-beginning 1) (match-end 1)) - hashtb)) - ;; Add this article to the list of read articles. - (push to-article to-reads) - ;; See if there are any marks and then add them. - (when (setq mark (assq (read (current-buffer)) marks)) - (setq marks (delq mark marks)) - (setcar mark to-article) - (push mark to-marks)) - (forward-line 1)) + (when (setq to-article + (gnus-gethash + (buffer-substring (match-beginning 1) (match-end 1)) + hashtb)) + ;; Add this article to the list of read articles. + (push to-article to-reads) + ;; See if there are any marks and then add them. + (when (setq mark (assq (read (current-buffer)) marks)) + (setq marks (delq mark marks)) + (setcar mark to-article) + (push mark to-marks)) + (forward-line 1))) ;; Now we know what the read articles are and what the ;; article marks are. We transform the information ;; into the Gnus info format. (setq to-reads (gnus-range-add - (gnus-compress-sequence (sort to-reads '<) t) + (gnus-compress-sequence (and to-reads (sort to-reads '<)) t) (cons 1 (1- (car to-active))))) (gnus-info-set-read info to-reads) ;; Do the marks. I'm sure y'all understand what's @@ -142,7 +147,8 @@ Update the .newsrc.eld file to reflect the change of nntp server." (cons article (cdr a))))) (setq a lists) (while a - (setcdr (car a) (gnus-compress-sequence (sort (cdar a) '<))) + (setcdr (car a) (gnus-compress-sequence + (and (cdar a) (sort (cdar a) '<)))) (pop a)) (gnus-info-set-marks info lists t))))) (gnus-message 7 "Translating %s...done" group)))