diff lisp/gnus/nnmairix.el @ 110410:f2e111723c3a

Merge changes made in Gnus trunk. Reimplement nnimap, and do tweaks to the rest of the code to support that. * gnus-int.el (gnus-finish-retrieve-group-infos) (gnus-retrieve-group-data-early): New functions. * gnus-range.el (gnus-range-nconcat): New function. * gnus-start.el (gnus-get-unread-articles): Support early retrieval of data. (gnus-read-active-for-groups): Support finishing the early retrieval of data. * gnus-sum.el (gnus-summary-move-article): Pass the move-to group name if the move is internal, so that nnimap can do fast internal moves. * gnus.el (gnus-article-special-mark-lists): Add uid/active tuples, for nnimap usage. * nnimap.el: Rewritten. * nnmail.el (nnmail-inhibit-default-split-group): New internal variable to allow the mail splitting to not return a default group. This is useful for nnimap, which will leave unmatched mail in the inbox. * utf7.el (utf7-encode): Autoload. Implement shell connection. * nnimap.el (nnimap-open-shell-stream): New function. (nnimap-open-connection): Use it. Get the number of lines by using BODYSTRUCTURE. (nnimap-transform-headers): Get the number of lines in each message. (nnimap-retrieve-headers): Query for BODYSTRUCTURE so that we get the number of lines. Not all servers return UIDNEXT. Work past this problem. Remove junk from end of file. Fix typo in "bogus" section. Make capabilties be case-insensitive. Require cl when compiling. Don't bug out if the LIST command doesn't have any parameters. 2010-09-17 Knut Anders Hatlen <kahatlen@gmail.com> (tiny change) * nnimap.el (nnimap-get-groups): Don't bug out if the LIST command doesn't have any parameters. (mm-text-html-renderer): Document gnus-article-html. 2010-09-17 Julien Danjou <julien@danjou.info> (tiny fix) * mm-decode.el (mm-text-html-renderer): Document gnus-article-html. * dgnushack.el: Define netrc-credentials. If the user doesn't have a /etc/services, supply some sensible port defaults. Have `unseen-or-unread' select an unread unseen article first. (nntp-open-server): Return whether the open was successful or not. Throughout all files, replace (save-excursion (set-buffer ...)) with (with-current-buffer ... ). Save result so that it doesn't say "failed" all the time. Add ~/.authinfo to the default, since that's probably most useful for users. Don't use the "finish" method when we're reading from the agent. Add some more nnimap-relevant agent stuff to nnagent.el. * nnimap.el (nnimap-with-process-buffer): Removed. Revert one line that was changed by mistake in the last checkin. (nnimap-open-connection): Don't error out when we can't make a connection nnimap-related changes to avoid bugging out if we can't contact a server. * gnus-start.el (gnus-get-unread-articles): Don't try to scan groups from methods that are denied. * nnimap.el (nnimap-possibly-change-group): Return nil if we can't log in. (nnimap-finish-retrieve-group-infos): Make sure we're not waiting for nothing. * gnus-sum.el (gnus-select-newsgroup): Indent.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sat, 18 Sep 2010 10:02:19 +0000
parents 5b9f64b04a04
children 93e093c035a0
line wrap: on
line diff
--- a/lisp/gnus/nnmairix.el	Sat Sep 18 11:38:52 2010 +0200
+++ b/lisp/gnus/nnmairix.el	Sat Sep 18 10:02:19 2010 +0000
@@ -445,8 +445,7 @@
       nil)
      ((not query)
       ;; No query -> return empty group
-      (save-excursion
-	(set-buffer nntp-server-buffer)
+      (with-current-buffer nntp-server-buffer
 	(erase-buffer)
 	(insert (concat "211 0 1 0 " group))
 	t))
@@ -501,9 +500,9 @@
 	  (nnmairix-request-group-with-article-number-correction
 	   folder qualgroup)))
        ((and (= rval 1)
-	     (save-excursion (set-buffer nnmairix-mairix-output-buffer)
-			     (goto-char (point-min))
-			     (looking-at "^Matched 0 messages")))
+	     (with-current-buffer nnmairix-mairix-output-buffer
+	       (goto-char (point-min))
+	       (looking-at "^Matched 0 messages")))
 	;; No messages found -> return empty group
 	(nnheader-message 5 "Mairix: No matches found.")
 	(set-buffer nntp-server-buffer)
@@ -584,8 +583,7 @@
   (when server (nnmairix-open-server server))
   (if (nnmairix-call-backend "request-list" nnmairix-backend-server)
       (let (cpoint cur qualgroup folder)
-	(save-excursion
-	  (set-buffer nntp-server-buffer)
+	(with-current-buffer nntp-server-buffer
 	  (goto-char (point-min))
 	  (setq cpoint (point))
 	  (while (re-search-forward nnmairix-group-regexp (point-max) t)
@@ -699,8 +697,7 @@
       (when (or (eq nnmairix-propagate-marks-upon-close t)
 		(and (eq nnmairix-propagate-marks-upon-close 'ask)
 		     (y-or-n-p "Propagate marks to original articles? ")))
-      (save-excursion
-	(set-buffer gnus-group-buffer)
+      (with-current-buffer gnus-group-buffer
 	(nnmairix-propagate-marks)
 	;; update mairix group
 	(gnus-group-jump-to-group qualgroup)
@@ -998,8 +995,7 @@
     (if server
 	(if (gnus-buffer-live-p gnus-article-buffer)
 	    (progn
-	      (save-excursion
-		(set-buffer gnus-article-buffer)
+	      (with-current-buffer gnus-article-buffer
 		(gnus-summary-toggle-header 1)
 		(setq mid (message-fetch-field "Message-ID")))
 	      (while (string-match "[<>]" mid)
@@ -1021,8 +1017,7 @@
     (if server
 	(if (gnus-buffer-live-p gnus-article-buffer)
 	    (progn
-	      (save-excursion
-		(set-buffer gnus-article-buffer)
+	      (with-current-buffer gnus-article-buffer
 		(gnus-summary-toggle-header 1)
 		(setq from (cadr (gnus-extract-address-components
 				  (gnus-fetch-field "From"))))
@@ -1046,8 +1041,7 @@
 	(when (nnmairix-call-backend
 	       "request-list" nnmairix-backend-server)
 	  (let (cur qualgroup folder)
-	    (save-excursion
-	      (set-buffer nntp-server-buffer)
+	    (with-current-buffer nntp-server-buffer
 	      (goto-char (point-min))
 	      (while (re-search-forward nnmairix-group-regexp (point-max) t)
 		(setq cur (match-string 0)
@@ -1152,8 +1146,7 @@
 		(push (list (car ogroup) (list (list number) (nth 1 mid-marks) (nth 2 mid-marks)))
 		      number-cache)))))
 	;; now we set the marks
-	(save-excursion
-	  (set-buffer gnus-group-buffer)
+	(with-current-buffer gnus-group-buffer
 	  (nnheader-message 5 "nnmairix: Propagating marks...")
 	  (dolist (cur number-cache)
 	    (setq method (gnus-find-method-for-group (car cur)))
@@ -1272,9 +1265,8 @@
   "Call mairix binary with COMMAND, using FOLDER and SEARCHQUERY.
 If THREADS is non-nil, enable full threads."
   (let ((args (cons (car command) '(nil t nil))))
-    (save-excursion
-      (set-buffer
-       (get-buffer-create nnmairix-mairix-output-buffer))
+    (with-current-buffer
+       (get-buffer-create nnmairix-mairix-output-buffer)
       (erase-buffer)
       (when (> (length command) 1)
 	(setq args (append args (cdr command))))
@@ -1291,9 +1283,8 @@
 (defun nnmairix-call-mairix-binary-raw (command query)
   "Call mairix binary with COMMAND and QUERY in raw mode."
   (let ((args (cons (car command) '(nil t nil))))
-    (save-excursion
-      (set-buffer
-       (get-buffer-create nnmairix-mairix-output-buffer))
+    (with-current-buffer
+       (get-buffer-create nnmairix-mairix-output-buffer)
       (erase-buffer)
       (when (> (length command) 1)
         (setq args (append args (cdr command))))
@@ -1430,8 +1421,7 @@
 	(corr (not (zerop numc)))
 	(name (buffer-name nntp-server-buffer))
 	header cur xref)
-    (save-excursion
-      (set-buffer buf)
+    (with-current-buffer buf
       (erase-buffer)
       (set-buffer nntp-server-buffer)
       (goto-char (point-min))
@@ -1621,8 +1611,7 @@
   (let ((server (nth 1 gnus-current-select-method))
 	mid rval group allgroups)
     ;; get message id
-    (save-excursion
-      (set-buffer gnus-article-buffer)
+    (with-current-buffer gnus-article-buffer
       (gnus-summary-toggle-header 1)
       (setq mid (message-fetch-field "Message-ID"))
       ;; first check the registry (if available)
@@ -1678,8 +1667,7 @@
     (if (zerop (nnmairix-call-mairix-binary-raw
 		(split-string nnmairix-mairix-command)
 		(list (concat "m:" mid))))
-	(save-excursion
-	  (set-buffer nnmairix-mairix-output-buffer)
+	(with-current-buffer nnmairix-mairix-output-buffer
 	  (goto-char (point-min))
 	  (while (re-search-forward "^/.*$" nil t)
 	    (push (nnmairix-get-group-from-file-path (match-string 0))