From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/66017 Path: news.gmane.org!not-for-mail From: Michael Sperber Newsgroups: gmane.emacs.gnus.general Subject: Patch submission: Allow group-local mail sources for nnmail Date: Tue, 01 Jan 2008 18:23:31 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1199213245 15240 80.91.229.12 (1 Jan 2008 18:47:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Jan 2008 18:47:25 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M14510@lists.math.uh.edu Tue Jan 01 19:47:45 2008 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.50) id 1J9m9K-00005g-OZ for ding-account@gmane.org; Tue, 01 Jan 2008 19:47:39 +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 1J9m7v-0005Jz-KY; Tue, 01 Jan 2008 12:46:11 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1J9krZ-00050Y-Kk for ding@lists.math.uh.edu; Tue, 01 Jan 2008 11:25:13 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1J9krX-0006uu-SG for ding@lists.math.uh.edu; Tue, 01 Jan 2008 11:25:13 -0600 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1J9krW-0001Mt-00 for ; Tue, 01 Jan 2008 18:25:10 +0100 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1J9krO-0000wr-GA for ding@gnus.org; Tue, 01 Jan 2008 17:25:02 +0000 Original-Received: from p5b204b70.dip.t-dialin.net ([91.32.75.112]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Jan 2008 17:25:02 +0000 Original-Received: from sperber by p5b204b70.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Jan 2008 17:25:02 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 148 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p5b204b70.dip.t-dialin.net User-Agent: Gnus/5.110007 (No Gnus v0.7) XEmacs/21.5-b28 (darwin) Cancel-Lock: sha1:PUM5aJlDFhMaPRsXagBXip+en0o= X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:66017 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi there, I've had the following problem forever: I get *lots* of e-mail, and I travel a lot. I often have a slow Internet connection. For this reason, I pre-sort the e-mail into different IMAP folders on the server, and would like to only selectively fetch what I want depending on where I am. Unfortunately, `mail-sources' is global to all groups---I would really like to say "fetch the new mail for this group from this IMAP folder". To do this, I've added a `group' mail source which activates a `mail-source' group parameter, which does the job. The attached patch is relative to today's CVS. Could this be applied to the code? Of course, I'm also happy to hear suggestions for improvement. 2008-01-01 Michael Sperber * mail-source.el (mail-sources): Add `group' choice. * nnmail.el (nnmail-get-new-mail-1): Abstract this out to add another parameter `in-group' to control into which group the articles go. Add treatment of `group' mail-source. 2008-01-01 Michael Sperber * gnus.texi (Mail Source Specifiers): Document `group' specifier. (Group Parameters): Document `mail-source' parameter. -- Cheers =8-} Mike Friede, Völkerverständigung und überhaupt blabla --=-=-= Content-Disposition: inline Index: lisp/mail-source.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/mail-source.el,v retrieving revision 7.24 diff -u -r7.24 mail-source.el --- lisp/mail-source.el 16 Dec 2007 04:23:18 -0000 7.24 +++ lisp/mail-source.el 1 Jan 2008 17:12:10 -0000 @@ -74,6 +74,8 @@ (repeat :tag "List" (choice :format "%[Value Menu%] %v" :value (file) + (cons :tag "Group parameter `mail-source'" + (const :format "" group)) (cons :tag "Spool file" (const :format "" file) (checklist :tag "Options" :greedy t Index: lisp/nnmail.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/nnmail.el,v retrieving revision 7.38 diff -u -r7.38 nnmail.el --- lisp/nnmail.el 16 Dec 2007 04:23:18 -0000 7.38 +++ lisp/nnmail.el 1 Jan 2008 17:12:11 -0000 @@ -1766,11 +1766,15 @@ (symbol-value sym)))) (defun nnmail-get-new-mail (method exit-func temp - &optional group spool-func) + &optional group spool-func) "Read new incoming mail." + (nnmail-get-new-mail-1 method exit-func temp group nil spool-func)) + +(defun nnmail-get-new-mail-1 (method exit-func temp + group in-group spool-func) + (let* ((sources mail-sources) fetching-sources - (group-in group) (i 0) (new 0) (total 0) @@ -1778,6 +1782,16 @@ (when (and (nnmail-get-value "%s-get-new-mail" method) sources) (while (setq source (pop sources)) + + ;; Use group's parameter + (when (eq (car source) 'group) + (let ((mail-sources + (list + (gnus-group-find-parameter (concat (symbol-name method) ":" group) + 'mail-source t)))) + (nnmail-get-new-mail-1 method exit-func temp group group spool-func)) + (setq source nil)) + ;; Hack to only fetch the contents of a single group's spool file. (when (and (eq (car source) 'directory) (null nnmail-scan-directory-mail-source-once) @@ -1816,9 +1830,10 @@ (nnmail-split-incoming file ',(intern (format "%s-save-mail" method)) ',spool-func - (if (equal file orig-file) - nil - (nnmail-get-split-group orig-file ',source)) + (or in-group + (if (equal file orig-file) + nil + (nnmail-get-split-group orig-file ',source))) ',(intern (format "%s-active-number" method))))))) (incf total new) (incf i))) Index: texi/gnus.texi =================================================================== RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v retrieving revision 7.267 diff -u -r7.267 gnus.texi --- texi/gnus.texi 28 Dec 2007 22:28:04 -0000 7.267 +++ texi/gnus.texi 1 Jan 2008 17:12:16 -0000 @@ -3035,6 +3035,12 @@ If it is set, the value is used as the method for posting message instead of @code{gnus-post-method}. +@item mail-source +@cindex mail-source +If it is set, and the setting of @code{mail-sources} includes a +@code{group} mail source (@pxref{Mail Sources}), the value specifies the +mail source for this group. + @item banner @cindex banner An item like @code{(banner . @var{regexp})} causes any part of an article @@ -14546,6 +14552,11 @@ :user "user-name" :password "secret") @end lisp + +@item group +Get the actual mail source from the @code{mail-source} group parameter, +@xref{Group Parameters}. + @end table @table @dfn --=-=-=--