changeset 110306:838fb634d1b0

Merge changes made in Gnus trunk. gnus-sum.el: Avoid calling a hook function per summary line; Call `gnus-summary-highlight-line' directly from all places that used to call it indirectly. netrc.el (netrc-credentials): New conveniency function. gnus-start.el (gnus-read-active-file-1): If gnus-agent isn't set, then do request scans from the backends.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sat, 11 Sep 2010 00:36:27 +0000
parents b10051866f51
children 5495085c9b6c
files lisp/ChangeLog lisp/gnus/ChangeLog lisp/gnus/gnus-start.el lisp/gnus/gnus-sum.el lisp/net/netrc.el
diffstat 5 files changed, 46 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 11 01:13:42 2010 +0200
+++ b/lisp/ChangeLog	Sat Sep 11 00:36:27 2010 +0000
@@ -1,3 +1,7 @@
+2010-09-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* net/netrc.el (netrc-credentials): New conveniency function.
+
 2010-09-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* textmodes/texinfo.el (texinfo-syntax-propertize-function): New fun
--- a/lisp/gnus/ChangeLog	Sat Sep 11 01:13:42 2010 +0200
+++ b/lisp/gnus/ChangeLog	Sat Sep 11 00:36:27 2010 +0000
@@ -1,3 +1,14 @@
+2010-09-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+	* gnus-start.el (gnus-read-active-file-1): If gnus-agent isn't set,
+	then do request scans from the backends.
+
+	* gnus-sum.el (gnus-summary-update-hook): Change default to nil, to
+	avoid running a hook per line, since this takes a lot of time,
+	profiling shows.
+	(gnus-summary-prepare-threads): Call `gnus-summary-highlight-line'
+	directly if gnus-visual-p is true.
+
 2010-09-10  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-start.el (gnus-read-active-for-groups): Check only subscribed
--- a/lisp/gnus/gnus-start.el	Sat Sep 11 01:13:42 2010 +0200
+++ b/lisp/gnus/gnus-start.el	Sat Sep 11 00:36:27 2010 +0000
@@ -2048,8 +2048,9 @@
     (gnus-message 5 mesg)
     (when (gnus-check-server method)
       ;; Request that the backend scan its incoming messages.
-      (when (and gnus-agent
-		 (gnus-online method)
+      (when (and (or (and gnus-agent
+			  (gnus-online method))
+		     (not gnus-agent))
 		 (gnus-check-backend-function 'request-scan (car method)))
 	(if infos
 	    (dolist (info infos)
--- a/lisp/gnus/gnus-sum.el	Sat Sep 11 01:13:42 2010 +0200
+++ b/lisp/gnus/gnus-sum.el	Sat Sep 11 00:36:27 2010 +0000
@@ -985,8 +985,7 @@
   :group 'gnus-various
   :type 'hook)
 
-(defcustom gnus-summary-update-hook
-  (list 'gnus-summary-highlight-line)
+(defcustom gnus-summary-update-hook nil
   "*A hook called when a summary line is changed.
 The hook will not be called if `gnus-visual' is nil.
 
@@ -3753,6 +3752,7 @@
       (error (gnus-message 5 "Error updating the summary line")))
     (when (gnus-visual-p 'summary-highlight 'highlight)
       (forward-line -1)
+      (gnus-summary-highlight-line)
       (gnus-run-hooks 'gnus-summary-update-hook)
       (forward-line 1))))
 
@@ -3785,6 +3785,7 @@
 	 'score))
       ;; Do visual highlighting.
       (when (gnus-visual-p 'summary-highlight 'highlight)
+	(gnus-summary-highlight-line)
 	(gnus-run-hooks 'gnus-summary-update-hook)))))
 
 (defvar gnus-tmp-new-adopts nil)
@@ -5363,7 +5364,9 @@
                'gnus-number number)
 	      (when gnus-visual-p
 		(forward-line -1)
-		(gnus-run-hooks 'gnus-summary-update-hook)
+		(gnus-summary-highlight-line)
+		(when gnus-summary-update-hook
+		  (gnus-run-hooks 'gnus-summary-update-hook))
 		(forward-line 1))
 
 	      (setq gnus-tmp-prev-subject simp-subject)))
@@ -10734,6 +10737,7 @@
 	 (t gnus-no-mark))
    'replied)
   (when (gnus-visual-p 'summary-highlight 'highlight)
+    (gnus-summary-highlight-line)
     (gnus-run-hooks 'gnus-summary-update-hook))
   t)
 
--- a/lisp/net/netrc.el	Sat Sep 11 01:13:42 2010 +0200
+++ b/lisp/net/netrc.el	Sat Sep 11 00:36:27 2010 +0000
@@ -54,12 +54,19 @@
  "Netrc configuration."
  :group 'comm)
 
+(defcustom netrc-file "~/.authinfo"
+  "File where user credentials are stored."
+  :type 'file
+  :group 'netrc)
+
 (defvar netrc-services-file "/etc/services"
   "The name of the services file.")
 
-(defun netrc-parse (file)
+(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)
       file
     (when (file-exists-p file)
@@ -221,6 +228,19 @@
 			  (eq type (car (cddr service)))))))
     (cadr service)))
 
+(defun netrc-credentials (machine &rest ports)
+  "Return a user name/password pair.
+Port specifications will be prioritised in the order they are
+listed in the PORTS list."
+  (let ((list (netrc-parse))
+	found)
+    (while (and ports
+		(not found))
+      (setq found (netrc-machine list machine (pop ports))))
+    (when found
+      (list (cdr (assoc "login" found))
+	    (cdr (assoc "password" found))))))
+
 (provide 'netrc)
 
 ;;; netrc.el ends here