diff lisp/net/netrc.el @ 110666:3b9bd3888ee9

nnimap.el (nnimap-request-accept-article): Get the Message-ID without the \r. nnimap.el (nnimap-find-article-by-message-id): Use EXAMINE instead of SELECT to get the message-id. gnus-art.el, gnus.el, nnimap.el: Fix up make-obsolete-variable declarations throughout. gnus.texi (Mail Source Specifiers): Remove webmail.el mentions. mail-source.el: Removed webmail support. nntp.el (nntp-server-list-active-group): Document. gnus.texi (NNTP): Document nntp-server-list-active-group. gnus.texi (Customizing the IMAP Connection): Remove extra quote. nnimap.el (nnimap-find-article-by-message-id): Really return the article number. nnimap.el: Add nnimap-split-fancy. netrc.el (netrc-credentials, netrc-machine): Return the value of the "default" entry. nnimap.el: Use tls.el exclusively, and not starttls.el at all. nnimap.el (nnimap-wait-for-connection): Accept the moronic openssl s_client -starttls output, too. nnrss.el (nnrss-use-local): Add documentation. message.el (message-ignored-supersedes-headers): Strip Injection-* headers before superseding. nnimap.el (nnimap-open-connection): Reinstate the auto-upgrade from unencrypted to STARTTLS, if possible. nnir.el: Use the server names without suffixes. gnus-sum.el (gnus-summary-show-thread): Skip past invisible text when expanding threads. gnus-registry.el: Don't follow nnmairix references. Install the nnregistry refer method. gnus.texi (Spam Package Configuration Examples, SpamOracle): Remove nnimap-split-rule from examples.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 01 Oct 2010 00:25:50 +0000
parents 867180d035b0
children db63bc492d85
line wrap: on
line diff
--- a/lisp/net/netrc.el	Thu Sep 30 16:26:40 2010 -0700
+++ b/lisp/net/netrc.el	Fri Oct 01 00:25:50 2010 +0000
@@ -131,19 +131,23 @@
       ;; No machine name matches, so we look for default entries.
       (while rest
 	(when (assoc "default" (car rest))
-	  (push (car rest) result))
+	  (let ((elem (car rest)))
+	    (setq elem (delete (assoc "default" elem) elem))
+	    (push elem result)))
 	(pop rest)))
     (when result
       (setq result (nreverse result))
-      (while (and result
-		  (not (netrc-port-equal
-			(or port defaultport "nntp")
-			;; when port is not given in the netrc file,
-			;; it should mean "any port"
-			(or (netrc-get (car result) "port")
-			    defaultport port))))
-	(pop result))
-      (car result))))
+      (if (not port)
+	  (car result)
+	(while (and result
+		    (not (netrc-port-equal
+			  (or port defaultport "nntp")
+			  ;; when port is not given in the netrc file,
+			  ;; it should mean "any port"
+			  (or (netrc-get (car result) "port")
+			      defaultport port))))
+	  (pop result))
+	(car result)))))
 
 (defun netrc-machine-user-or-password (mode authinfo-file-or-list machines ports defaults)
   "Get the user name or password according to MODE from AUTHINFO-FILE-OR-LIST.
@@ -238,9 +242,11 @@
 listed in the PORTS list."
   (let ((list (netrc-parse))
 	found)
-    (while (and ports
-		(not found))
-      (setq found (netrc-machine list machine (pop ports))))
+    (if (not ports)
+	(setq found (netrc-machine list machine))
+      (while (and ports
+		  (not found))
+	(setq found (netrc-machine list machine (pop ports)))))
     (when found
       (list (cdr (assoc "login" found))
 	    (cdr (assoc "password" found))))))