changeset 111952:db63bc492d85

Merge changes made in Gnus trunk. nnir.el (nnir-run-imap): Return article list in UID order. gnus-start.el (gnus-auto-subscribed-groups): Add nnimap to the list of automatically subscribed groups. (gnus-auto-subscribed-categories): New variable. (gnus-matches-options-n): Use it. (gnus-default-subscribed-newsgroups): Remove unused variable. (gnus-start-draft-setup): Message a bit less. gnus-agent.el (gnus-agentize): Don't create the queue group automatically on startup. It'll be created later, if needed. gnus-start.el (gnus-1): Clarify comment. (gnus-matches-options-n): Fix typo in last change. (gnus-1): Don't create the nndrafts group twice. (gnus-setup-news): There's no need to read the active file here, since that's done again later on a per-backend basis. (gnus-start-draft-setup): Make sure that the new group is started out empty. netrc.el (netrc-point-at-eol): Remove the unused netrc-point-at-old and netrc-bound-and-true-p bindings. (netrc-parse): Cache the netrc contents.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Mon, 13 Dec 2010 22:29:12 +0000
parents 027c7b917c8a
children 9d703d5d5634
files doc/misc/ChangeLog doc/misc/gnus.texi lisp/ChangeLog lisp/gnus/ChangeLog lisp/gnus/gnus-agent.el lisp/gnus/gnus-start.el lisp/gnus/nnir.el lisp/net/netrc.el
diffstat 8 files changed, 84 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/doc/misc/ChangeLog	Mon Dec 13 23:20:32 2010 +0100
+++ b/doc/misc/ChangeLog	Mon Dec 13 22:29:12 2010 +0000
@@ -1,3 +1,10 @@
+2010-12-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus.texi (Filtering New Groups): Mention
+	gnus-auto-subscribed-categories.
+	(The First Time): Removed, since default-subscribed-newsgroups has been
+	removed.
+
 2010-12-13  Glenn Morris  <rgm@gnu.org>
 
 	* cl.texi (For Clauses): Small fixes for frames and windows.
--- a/doc/misc/gnus.texi	Mon Dec 13 23:20:32 2010 +0100
+++ b/doc/misc/gnus.texi	Mon Dec 13 22:29:12 2010 +0000
@@ -428,7 +428,6 @@
 Starting Gnus
 
 * Finding the News::            Choosing a method for getting news.
-* The First Time::              What does Gnus do the first time you start it?
 * The Server is Down::          How can I read my mail then?
 * Slave Gnusae::                You can have more than one Gnus active at a time.
 * Fetching a Group::            Starting Gnus just to read a group.
@@ -959,7 +958,6 @@
 
 @menu
 * Finding the News::      Choosing a method for getting news.
-* The First Time::        What does Gnus do the first time you start it?
 * The Server is Down::    How can I read my mail then?
 * Slave Gnusae::          You can have more than one Gnus active at a time.
 * New Groups::            What is Gnus supposed to do with new groups?
@@ -1052,31 +1050,6 @@
 new articles.  @xref{NNTP marks}, for more information.
 
 
-@node The First Time
-@section The First Time
-@cindex first time usage
-
-If no startup files exist (@pxref{Startup Files}), Gnus will try to
-determine what groups should be subscribed by default.
-
-@vindex gnus-default-subscribed-newsgroups
-If the variable @code{gnus-default-subscribed-newsgroups} is set, Gnus
-will subscribe you to just those groups in that list, leaving the rest
-killed.  Your system administrator should have set this variable to
-something useful.
-
-Since she hasn't, Gnus will just subscribe you to a few arbitrarily
-picked groups (i.e., @samp{*.newusers}).  (@dfn{Arbitrary} is defined
-here as @dfn{whatever Lars thinks you should read}.)
-
-You'll also be subscribed to the Gnus documentation group, which should
-help you with most common problems.
-
-If @code{gnus-default-subscribed-newsgroups} is @code{t}, Gnus will just
-use the normal functions for handling new groups, and not do anything
-special.
-
-
 @node The Server is Down
 @section The Server is Down
 @cindex server errors
@@ -1321,11 +1294,18 @@
 more meant for setting some ground rules, while the other variable is
 used more for user fiddling.  By default this variable makes all new
 groups that come from mail back ends (@code{nnml}, @code{nnbabyl},
-@code{nnfolder}, @code{nnmbox}, @code{nnmh}, and @code{nnmaildir})
-subscribed.  If you don't like that, just set this variable to
-@code{nil}.
-
-New groups that match this regexp are subscribed using
+@code{nnfolder}, @code{nnmbox}, @code{nnmh}, @code{nnimap}, and
+@code{nnmaildir}) subscribed.  If you don't like that, just set this
+variable to @code{nil}.
+
+@vindex gnus-auto-subscribed-categories
+As if that wasn't enough, @code{gnus-auto-subscribed-categories} also
+allows you to specify that new groups should be subcribed based on the
+category their select methods belong to.  The default is @samp{(mail
+post-mail)}, meaning that all new groups from mail-like backends
+should be subscribed automatically.
+
+New groups that match these variables are subscribed using
 @code{gnus-subscribe-options-newsgroup-method}.
 
 
--- a/lisp/ChangeLog	Mon Dec 13 23:20:32 2010 +0100
+++ b/lisp/ChangeLog	Mon Dec 13 22:29:12 2010 +0000
@@ -2,6 +2,12 @@
 
 	* net/gnutls.el (gnutls-negotiate): Fix setting of default trustfiles.
 
+2010-12-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* net/netrc.el (netrc-point-at-eol): Remove the unused
+	netrc-point-at-old and netrc-bound-and-true-p bindings.
+	(netrc-parse): Cache the netrc contents.
+
 2010-12-13  Eli Zaretskii  <eliz@gnu.org>
 
 	* subr.el (posn-col-row): Evaluate header-line-format in the
--- a/lisp/gnus/ChangeLog	Mon Dec 13 23:20:32 2010 +0100
+++ b/lisp/gnus/ChangeLog	Mon Dec 13 22:29:12 2010 +0000
@@ -1,3 +1,27 @@
+2010-12-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-start.el (gnus-matches-options-n): Fix typo in last change.
+	(gnus-1): Don't create the nndrafts group twice.
+	(gnus-setup-news): There's no need to read the active file here, since
+	that's done again later on a per-backend basis.
+	(gnus-start-draft-setup): Make sure that the new group is started out
+	empty.
+
+	* gnus-agent.el (gnus-agentize): Don't create the queue group
+	automatically on startup.  It'll be created later, if needed.
+
+	* gnus-start.el (gnus-auto-subscribed-groups): Add nnimap to the list
+	of automatically subscribed groups.
+	(gnus-auto-subscribed-categories): New variable.
+	(gnus-matches-options-n): Use it.
+	(gnus-default-subscribed-newsgroups): Remove unused variable.
+	(gnus-start-draft-setup): Message a bit less.
+
+2010-12-13  Andrew Cohen  <cohen@andy.bu.edu>
+
+	* nnir.el (nnir-run-imap): Return article list in order of increasing
+	UID.
+
 2010-12-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* gnus-sum.el (gnus-summary-enter-digest-group): Mention
--- a/lisp/gnus/gnus-agent.el	Mon Dec 13 23:20:32 2010 +0100
+++ b/lisp/gnus/gnus-agent.el	Mon Dec 13 22:29:12 2010 +0000
@@ -685,7 +685,6 @@
 minor mode in all Gnus buffers."
   (interactive)
   (gnus-open-agent)
-  (add-hook 'gnus-setup-news-hook 'gnus-agent-queue-setup)
   (unless gnus-agent-send-mail-function
     (setq gnus-agent-send-mail-function
 	  (or message-send-mail-real-function
--- a/lisp/gnus/gnus-start.el	Mon Dec 13 23:20:32 2010 +0100
+++ b/lisp/gnus/gnus-start.el	Mon Dec 13 22:29:12 2010 +0000
@@ -86,14 +86,6 @@
   :group 'gnus-start
   :type '(choice file (const nil)))
 
-(defcustom gnus-default-subscribed-newsgroups nil
-  "List of newsgroups to subscribe, when a user runs Gnus the first time.
-The value should be a list of strings.
-If it is t, Gnus will not do anything special the first time it is
-started; it'll just use the normal newsgroups subscription methods."
-  :group 'gnus-start
-  :type '(choice (repeat string) (const :tag "Nothing special" t)))
-
 (defcustom gnus-use-dribble-file t
   "*Non-nil means that Gnus will use a dribble file to store user updates.
 If Emacs should crash without saving the .newsrc files, complete
@@ -341,8 +333,17 @@
   :group 'gnus-group-new
   :type 'boolean)
 
+(defcustom gnus-auto-subscribed-categories '(mail post-mail)
+  "*New groups from methods of these categories will be subscribed automatically.
+Note that this variable only deals with new groups.  It has no
+effect whatsoever on old groups.  The default is to automatically
+subscribe all groups from mail-like backends."
+  :version "24.1"
+  :group 'gnus-group-new
+  :type '(repeat symbol))
+
 (defcustom gnus-auto-subscribed-groups
-  "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl\\|^nnmaildir"
+  "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl\\|^nnmaildir\\|^nnimap"
   "*All new groups that match this regexp will be subscribed automatically.
 Note that this variable only deals with new groups.  It has no effect
 whatsoever on old groups.
@@ -784,10 +785,9 @@
 		    (gnus-start-news-server (and arg (not level))))))
 	(if (and (not dont-connect)
 		 (not did-connect))
+	    ;; Couldn't connect to the server, so bail out.
 	    (gnus-group-quit)
 	  (gnus-run-hooks 'gnus-startup-hook)
-	  ;; NNTP server is successfully open.
-
 	  ;; Find the current startup file name.
 	  (setq gnus-current-startup-file
 		(gnus-make-newsrc-file gnus-startup-file))
@@ -797,11 +797,10 @@
 	    (gnus-dribble-read-file))
 
 	  ;; Do the actual startup.
-	  (if gnus-agent
-	      (gnus-request-create-group "queue" '(nndraft "")))
-	  (gnus-request-create-group "drafts" '(nndraft ""))
 	  (gnus-setup-news nil level dont-connect)
 	  (gnus-run-hooks 'gnus-setup-news-hook)
+	  (when gnus-agent
+	    (gnus-request-create-group "queue" '(nndraft "")))
 	  (gnus-start-draft-setup)
 	  ;; Generate the group buffer.
 	  (gnus-group-list-groups level)
@@ -816,10 +815,10 @@
   (gnus-request-create-group "drafts" '(nndraft ""))
   (unless (gnus-group-entry "nndraft:drafts")
     (let ((gnus-level-default-subscribed 1))
-      (gnus-subscribe-group "nndraft:drafts" nil '(nndraft ""))))
+      (gnus-subscribe-group "nndraft:drafts" nil '(nndraft "")))
+    (setcar (gnus-group-entry "nndraft:drafts") 0))
   (unless (equal (gnus-group-get-parameter "nndraft:drafts" 'gnus-dummy t)
 		 '((gnus-draft-mode)))
-    (gnus-message 3 "Setting up drafts group")
     (gnus-group-set-parameter
      "nndraft:drafts" 'gnus-dummy '((gnus-draft-mode)))))
 
@@ -996,27 +995,8 @@
     (when (or (null gnus-read-active-file)
 	      (eq gnus-read-active-file 'some))
       (gnus-update-active-hashtb-from-killed))
-
-    ;; Validate agent covered methods now that gnus-server-alist has
-    ;; been initialized.
-    ;; NOTE: This is here for one purpose only.  By validating the
-    ;; agentized server's, it converts the old 5.10.3, and earlier,
-    ;; format to the current format.  That enables the agent code
-    ;; within gnus-read-active-file to function correctly.
-    (if gnus-agent
-        (gnus-agent-read-servers-validate))
-
-    ;; Read the active file and create `gnus-active-hashtb'.
-    ;; If `gnus-read-active-file' is nil, then we just create an empty
-    ;; hash table.  The partial filling out of the hash table will be
-    ;; done in `gnus-get-unread-articles'.
-    (and gnus-read-active-file
-	 (not level)
-	 (gnus-read-active-file nil dont-connect))
-
     (unless gnus-active-hashtb
       (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
-
     ;; Initialize the cache.
     (when gnus-use-cache
       (gnus-cache-open))
@@ -1158,6 +1138,12 @@
    ((and gnus-options-subscribe
 	 (string-match gnus-options-subscribe group))
     'subscribe)
+   ((let ((do-subscribe nil))
+      (dolist (category gnus-auto-subscribed-categories)
+	(when (gnus-member-of-valid category group)
+	  (setq do-subscribe t)))
+      do-subscribe)
+    'subscribe)
    ((and gnus-auto-subscribed-groups
 	 (string-match gnus-auto-subscribed-groups group))
     'subscribe)
--- a/lisp/gnus/nnir.el	Mon Dec 13 23:20:32 2010 +0100
+++ b/lisp/gnus/nnir.el	Mon Dec 13 22:29:12 2010 +0000
@@ -804,7 +804,7 @@
 		      (message "Searching %s... %d matches" group arts)))
 		  (message "Searching %s...done" group))
 	      (quit nil))
-	    artlist))
+	    (nreverse artlist)))
 	groups)))))
 
 (defun nnir-imap-make-query (criteria qstring)
--- a/lisp/net/netrc.el	Mon Dec 13 23:20:32 2010 +0100
+++ b/lisp/net/netrc.el	Mon Dec 13 22:29:12 2010 +0000
@@ -34,18 +34,6 @@
 ;;; .netrc and .authinfo rc parsing
 ;;;
 
-(defalias 'netrc-point-at-eol
-  (if (fboundp 'point-at-eol)
-      'point-at-eol
-    'line-end-position))
-(eval-when-compile
-  ;; This is unnecessary in the compiled version as it is a macro.
-  (if (fboundp 'bound-and-true-p)
-      (defalias 'netrc-bound-and-true-p 'bound-and-true-p)
-    (defmacro netrc-bound-and-true-p (var)
-      "Return the value of symbol VAR if it is bound, else nil."
-      `(and (boundp (quote ,var)) ,var))))
-
 (defgroup netrc nil
  "Netrc configuration."
  :group 'comm)
@@ -58,12 +46,15 @@
 (defvar netrc-services-file "/etc/services"
   "The name of the services file.")
 
+(defvar netrc-cache nil)
+
 (defun netrc-parse (&optional file)
   (interactive "fFile to Parse: ")
   "Parse FILE and return a list of all entries in the file."
   (unless file
     (setq file netrc-file))
   (if (listp file)
+      ;; We got already parsed contents; just return it.
       file
     (when (file-exists-p file)
       (with-temp-buffer
@@ -71,7 +62,16 @@
 			"password" "account" "macdef" "force"
 			"port"))
 	      alist elem result pair)
-          (insert-file-contents file)
+          (if (and netrc-cache
+		   (equal (car netrc-cache) (nth 5 (file-attributes file))))
+	      ;; Store the contents of the file heavily encrypted in memory.
+	      (insert (base64-decode-string (rot13-string (cdr netrc-cache))))
+	    (insert-file-contents file)
+	    (when (string-match "\\.gpg\\'" file)
+	      (setq netrc-cache (cons (nth 5 (file-attributes file))
+				      (rot13-string
+				       (base64-encode-string
+					(buffer-string)))))))
 	  (goto-char (point-min))
 	  ;; Go through the file, line by line.
 	  (while (not (eobp))