diff lisp/gnus/nnml.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 f81515cea5ce
children 93e093c035a0
line wrap: on
line diff
--- a/lisp/gnus/nnml.el	Sat Sep 18 11:38:52 2010 +0200
+++ b/lisp/gnus/nnml.el	Sat Sep 18 10:02:19 2010 +0000
@@ -160,8 +160,7 @@
 
 (deffoo nnml-retrieve-headers (sequence &optional group server fetch-old)
   (when (nnml-possibly-change-directory group server)
-    (save-excursion
-      (set-buffer nntp-server-buffer)
+    (with-current-buffer nntp-server-buffer
       (erase-buffer)
       (let* ((file nil)
 	     (number (length sequence))
@@ -405,8 +404,7 @@
      (let (nnml-current-directory
 	   nnml-current-group
 	   nnml-article-file-alist)
-       (save-excursion
-	 (set-buffer buf)
+       (with-current-buffer buf
 	 (insert-buffer-substring nntp-server-buffer)
 	 (setq result (eval accept-form))
 	 (kill-buffer (current-buffer))
@@ -462,8 +460,7 @@
 
 (deffoo nnml-request-replace-article (article group buffer)
   (nnml-possibly-change-directory group)
-  (save-excursion
-    (set-buffer buffer)
+  (with-current-buffer buffer
     (nnml-possibly-create-directory group)
     (let ((chars (nnmail-insert-lines))
 	  (art (concat (int-to-string article) "\t"))
@@ -478,8 +475,7 @@
 	      t)
 	(setq headers (nnml-parse-head chars article))
 	;; Replace the NOV line in the NOV file.
-	(save-excursion
-	  (set-buffer (nnml-open-nov group))
+	(with-current-buffer (nnml-open-nov group)
 	  (goto-char (point-min))
 	  (if (or (looking-at art)
 		  (search-forward (concat "\n" art) nil t))
@@ -614,8 +610,7 @@
 
 ;; Find an article number in the current group given the Message-ID.
 (defun nnml-find-group-number (id server)
-  (save-excursion
-    (set-buffer (get-buffer-create " *nnml id*"))
+  (with-current-buffer (get-buffer-create " *nnml id*")
     (let ((alist nnml-group-alist)
 	  number)
       ;; We want to look through all .overview files, but we want to
@@ -657,8 +652,7 @@
       nil
     (let ((nov (expand-file-name nnml-nov-file-name nnml-current-directory)))
       (when (file-exists-p nov)
-	(save-excursion
-	  (set-buffer nntp-server-buffer)
+	(with-current-buffer nntp-server-buffer
 	  (erase-buffer)
 	  (nnheader-insert-file-contents nov)
 	  (if (and fetch-old
@@ -804,16 +798,14 @@
 
 (defun nnml-add-incremental-nov (group article headers)
   "Add a nov line for the GROUP nov headers, incrementally."
-  (save-excursion
-    (set-buffer (nnml-open-incremental-nov group))
+  (with-current-buffer (nnml-open-incremental-nov group)
     (goto-char (point-max))
     (mail-header-set-number headers article)
     (nnheader-insert-nov headers)))
 
 (defun nnml-add-nov (group article headers)
   "Add a nov line for the GROUP base."
-  (save-excursion
-    (set-buffer (nnml-open-nov group))
+  (with-current-buffer (nnml-open-nov group)
     (goto-char (point-max))
     (mail-header-set-number headers article)
     (nnheader-insert-nov headers)))
@@ -844,8 +836,7 @@
 					      "")
 					    decoded)))
 	 (file-name-coding-system nnmail-pathname-coding-system))
-    (save-excursion
-      (set-buffer buffer)
+    (with-current-buffer buffer
       (set (make-local-variable 'nnml-nov-buffer-file-name)
 	   (nnmail-group-pathname decoded nnml-directory nnml-nov-file-name))
       (erase-buffer)
@@ -942,9 +933,8 @@
 	 (nov (concat dir nnml-nov-file-name))
 	 (nov-buffer (get-buffer-create " *nov*"))
 	 chars file headers)
-    (save-excursion
+    (with-current-buffer nov-buffer
       ;; Init the nov buffer.
-      (set-buffer nov-buffer)
       (buffer-disable-undo)
       (erase-buffer)
       (set-buffer nntp-server-buffer)
@@ -964,20 +954,17 @@
 	  (unless (zerop (buffer-size))
 	    (goto-char (point-min))
 	    (setq headers (nnml-parse-head chars (caar files)))
-	    (save-excursion
-	      (set-buffer nov-buffer)
+	    (with-current-buffer nov-buffer
 	      (goto-char (point-max))
 	      (nnheader-insert-nov headers)))
 	  (widen))
 	(setq files (cdr files)))
-      (save-excursion
-	(set-buffer nov-buffer)
+      (with-current-buffer nov-buffer
 	(nnmail-write-region (point-min) (point-max) nov nil 'nomesg)
 	(kill-buffer (current-buffer))))))
 
 (defun nnml-nov-delete-article (group article)
-  (save-excursion
-    (set-buffer (nnml-open-nov group))
+  (with-current-buffer (nnml-open-nov group)
     (when (nnheader-find-nov-line article)
       (delete-region (point) (progn (forward-line 1) (point)))
       (when (bobp)
@@ -1260,8 +1247,7 @@
 		  (gnus-info-set-marks info newmarks))
 		;; 3/ Update the NOV entry for this article:
 		(unless nnml-nov-is-evil
-		  (save-excursion
-		    (set-buffer (nnml-open-nov group))
+		  (with-current-buffer (nnml-open-nov group)
 		    (when (nnheader-find-nov-line old-number)
 		      ;; Replace the article number:
 		      (looking-at old-number-string)