From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/77861 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.gnus.general Subject: Re: moving from nnml to nnimap Date: Thu, 17 Mar 2011 09:13:50 +0100 Message-ID: <8762riyxj5.fsf@marauder.physik.uni-ulm.de> References: <86ipvl5vfi.fsf@red.stonehenge.com> <87d3lt8nsv.fsf@lifelogs.com> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1300349655 24179 80.91.229.12 (17 Mar 2011 08:14:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 17 Mar 2011 08:14:15 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M26179@lists.math.uh.edu Thu Mar 17 09:14:08 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q08LN-00082U-9h for ding-account@gmane.org; Thu, 17 Mar 2011 09:14:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Q08LJ-0006tD-8W; Thu, 17 Mar 2011 03:14:01 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Q08LH-0006sp-9r for ding@lists.math.uh.edu; Thu, 17 Mar 2011 03:13:59 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Q08LF-0007VH-7q for ding@lists.math.uh.edu; Thu, 17 Mar 2011 03:13:59 -0500 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1Q08LD-0005JO-S2 for ding@gnus.org; Thu, 17 Mar 2011 09:13:55 +0100 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.175]) by mail.uni-ulm.de (8.14.3/8.14.2) with ESMTP id p2H8DrY0027245 for ; Thu, 17 Mar 2011 09:13:54 +0100 (MET) Original-Received: from localhost (localhost [127.0.0.1]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 3FAAC10904 for ; Thu, 17 Mar 2011 09:13:53 +0100 (CET) X-Face: 3Phac&+dw=IZHjhua]bp}LH<*p{qzj8u+ Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:77861 Archived-At: On Tue, Mar 15 2011, Lars Magne Ingebrigtsen wrote: > Ted Zlatanov writes: > >> I don't know of one. You basically need to do (open group with C-u to >> see all articles, mark all articles, copy to >> (gnus-newsgroup-name =~ s/nnml/nnimap/) ) 300 times. It can be >> automated I guess, but no one has needed the automation badly enough. >> If you want I can write a function to do it. > > It sounds like a good idea. The ability to, say, slurp down all > groups/messages from IMAP server A to move them to server B sounds > useful, too, so this should be a quite general command. Perhaps in the > server buffer? "Copy (or move?) all messages from server Foo to server > Bar?" I have been using this code[1]: --8<---------------cut here---------------start------------->8--- (defvar rs-gnus-migrate-old-group-regexp "^nnmaildir.personal:" "Regexp matching old groups.") (defvar rs-gnus-migrate-target-group-prefix "nnml+personal:" "Prefix for new groups.") ;; (defvar rs-gnus-migrate-transform-function nil ;; ;; 'rs-gnus-migrate-transform ;; "Transform old name to new name") ;; (defun rs-gnus-migrate-transform (oldname) ;; "Transform old name, return new name" ;; (gnus-replace-in-string oldname "^.*:\\(News\\|Lists\\|Root\\)\\." "")) ;;;###autoload (defun rs-gnus-migrate-loop (&optional copy) (interactive) (let (gnus-large-newsgroup gnus-parameters case-fold-search g-list full oldmethod g-name fulltarget level) (dolist (group gnus-newsrc-alist) ;; loop over all groups (setq full (car group)) (setq oldmethod (gnus-replace-in-string full (regexp-quote (gnus-replace-in-string full "^.*:" "")) "")) (if (fboundp rs-gnus-migrate-transform-function) (setq g-name (funcall rs-gnus-migrate-transform-function full)) (setq g-name (gnus-replace-in-string full "^.*:" ""))) ;; (setq fulltarget (concat rs-gnus-migrate-target-group-prefix g-name)) (when (string-match rs-gnus-migrate-old-group-regexp full) (when (string= oldmethod "") (setq oldmethod nil)) (gnus-message 5 "full=`%s',\n oldmethod=`%s',\n g-name=`%s',\n fulltarget=`%s'" full oldmethod g-name fulltarget) ;;))));; when DUMMY ;; Create target group next to the old one: (gnus-group-jump-to-group full) ;; j (setq level (gnus-group-group-level)) ;; create target group unless it already exists: (save-excursion (if (gnus-gethash fulltarget gnus-newsrc-hashtb) (gnus-group-jump-to-group fulltarget) (gnus-group-make-group g-name ;; FIXME: Use Gnus functions instead of regexps. Which one? ;; FIXME: Use gnus-group-real-name? (gnus-replace-in-string rs-gnus-migrate-target-group-prefix "^\\([^+:]*\\).*$" "\\1") (gnus-replace-in-string rs-gnus-migrate-target-group-prefix "^[^+]+\\+\\([^:]+\\).*$" "\\1"))) (gnus-group-set-current-level nil level)) (if (and (gnus-activate-group full) (gnus-group-quick-select-group t)) ;; 0 M-RET (progn (gnus-summary-toggle-threads -1) (gnus-summary-sort-by-date) ;; optional (gnus-uu-mark-buffer) ;; M P b ;; Maybe use `-move-' here: (if copy (gnus-summary-copy-article nil fulltarget) (gnus-summary-move-article nil fulltarget)) (sit-for 1) (gnus-summary-exit)) (gnus-message 1 "Skipped inactivate group %s" full)) ;; Maybe unsubscribe/delete old group here: ;; ... (gnus-group-change-level full gnus-level-killed) (gnus-message 7 "Processed `%s'" g-name) (sit-for 1))))) --8<---------------cut here---------------end--------------->8--- [1] See also ... ,----[ http://article.gmane.org/gmane.emacs.gnus.general/53300 ] | From: Reiner Steib | Subject: Re: POP to IMAP | Newsgroups: gmane.emacs.gnus.general | Date: 2003-07-01 13:33:22 GMT `---- Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/