changeset 111721:7bb815042e61

nnml.el, nnfolder.el, nntp.el (*-request-set-mark): Extend syntax with 'set. nnheader.el, nntp.el, nnfolder.el, nnml.el (*-request-set-mark): Refactor out nnheader-update-marks-actions and use it throughout. nnmaildir.el (nnmaildir-request-set-mark): Be explicit about 'set. gnus-sum.el (gnus-summary-push-marks-to-backend): Use 'set instead of 'add and 'delete to set backend marks.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 26 Nov 2010 02:11:40 +0000
parents cb1fa19c3f33
children c0bbb7dd9600
files lisp/gnus/ChangeLog lisp/gnus/gnus-sum.el lisp/gnus/nnfolder.el lisp/gnus/nnheader.el lisp/gnus/nnimap.el lisp/gnus/nnmaildir.el lisp/gnus/nnml.el lisp/gnus/nntp.el
diffstat 8 files changed, 57 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/ChangeLog	Fri Nov 26 02:11:40 2010 +0000
@@ -1,5 +1,18 @@
 2010-11-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+	* gnus-sum.el (gnus-summary-push-marks-to-backend): Use 'set instead of
+	'add and 'delete to set backend marks.
+
+	* nnmaildir.el (nnmaildir-request-set-mark): Be explicit about 'set.
+
+	* nnheader.el (nnheader-update-marks-actions): Refactor out.
+
+	* nntp.el (nntp-request-set-mark): Use it.
+
+	* nnfolder.el (nnfolder-request-set-mark): Ditto.
+
+	* nnml.el (nnml-request-set-mark): Ditto.
+
 	* nnimap.el (nnimap-last-response-string): Remove the unfolding -- it
 	introduces regressions in article selection.
 	(nnimap-find-uid-response): New function.
@@ -7,6 +20,13 @@
 	(nnimap-request-move-article): Use the UID returned, if any.
 	(nnimap-get-groups): Reimplement to work with folded lines.
 	(nnimap-find-uid-response): The UID is the last element in the list.
+	(nnimap-request-set-mark): Extend syntax with 'set.
+
+	* nnml.el (nnml-request-set-mark): Ditto.
+
+	* nnfolder.el (nnfolder-request-set-mark): Ditto.
+
+	* nntp.el (nntp-request-set-mark): Ditto.
 
 2010-11-25  Katsumi Yamaoka  <yamaoka@jpl.org>
 
--- a/lisp/gnus/gnus-sum.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/gnus-sum.el	Fri Nov 26 02:11:40 2010 +0000
@@ -9948,23 +9948,18 @@
     (gnus-set-mode-line 'summary)))
 
 (defun gnus-summary-push-marks-to-backend (article)
-  (let ((add nil)
-	(delete nil)
+  (let ((set nil)
 	(marks gnus-article-mark-lists))
-    (if (memq article gnus-newsgroup-unreads)
-	(push 'read add)
-      (push 'read delete))
+    (when (memq article gnus-newsgroup-unreads)
+      (push 'read set))
     (while marks
-      (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
-	(if (memq article (symbol-value
-			   (intern (format "gnus-newsgroup-%s"
-					   (caar marks)))))
-	    (push (cdar marks) add)
-	  (push (cdar marks) delete)))
+      (when (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
+		 (memq article (symbol-value
+				(intern (format "gnus-newsgroup-%s"
+						(caar marks))))))
+	(push (cdar marks) set))
       (pop marks))
-    (gnus-request-set-mark gnus-newsgroup-name
-			   `(((,article) add ,add)
-			     ((,article) del ,delete)))))
+    (gnus-request-set-mark gnus-newsgroup-name `(((,article) set ,set)))))
 
 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
   "Copy the current article to some other group.
--- a/lisp/gnus/nnfolder.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/nnfolder.el	Fri Nov 26 02:11:40 2010 +0000
@@ -1186,19 +1186,7 @@
     (nnfolder-open-server server))
   (unless nnfolder-marks-is-evil
     (nnfolder-open-marks group server)
-    (dolist (action actions)
-      (let ((range (nth 0 action))
-	    (what  (nth 1 action))
-	    (marks (nth 2 action)))
-	(assert (or (eq what 'add) (eq what 'del)) nil
-		"Unknown request-set-mark action: %s" what)
-	(dolist (mark marks)
-	  (setq nnfolder-marks (gnus-update-alist-soft
-			    mark
-			    (funcall (if (eq what 'add) 'gnus-range-add
-				       'gnus-remove-from-range)
-				     (cdr (assoc mark nnfolder-marks)) range)
-			    nnfolder-marks)))))
+    (setq nnfolder-marks (nnheader-update-marks-actions nnfolder-marks actions))
     (nnfolder-save-marks group server))
   nil)
 
--- a/lisp/gnus/nnheader.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/nnheader.el	Fri Nov 26 02:11:40 2010 +0000
@@ -1078,6 +1078,26 @@
 		   (truncate nnheader-read-timeout))
 		1000))))
 
+(defun nnheader-update-marks-actions (backend-marks actions)
+  (dolist (action actions)
+    (let ((range (nth 0 action))
+	  (what  (nth 1 action))
+	  (marks (nth 2 action)))
+      (dolist (mark marks)
+	(setq backend-marks
+	      (gnus-update-alist-soft
+	       mark
+	       (cond
+		((eq what 'add)
+		 (gnus-range-add (cdr (assoc mark backend-marks)) range)
+		 ((eq what 'del)
+		  (gnus-remove-from-range
+		   (cdr (assoc mark backend-marks)) range))
+		 ((eq what 'set)
+		  range)))
+	       backend-marks)))))
+  backend-marks)
+
 (when (featurep 'xemacs)
   (require 'nnheaderxm))
 
--- a/lisp/gnus/nnimap.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/nnimap.el	Fri Nov 26 02:11:40 2010 +0000
@@ -941,9 +941,10 @@
 		(setq sequence (nnimap-send-command
 				"UID STORE %s %sFLAGS.SILENT (%s)"
 				(nnimap-article-ranges range)
-				(if (eq action 'del)
-				    "-"
-				  "+")
+				(cond
+				 ((eq action 'del) "-")
+				 ((eq action 'add) "-")
+				 ((eq action 'set) ""))
 				(mapconcat #'identity flags " ")))))))
 	;; Wait for the last command to complete to avoid later
 	;; syncronisation problems with the stream.
--- a/lisp/gnus/nnmaildir.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/nnmaildir.el	Fri Nov 26 02:11:40 2010 +0000
@@ -1590,7 +1590,7 @@
 	(nnmaildir--nlist-iterate nlist ranges
 				  (cond ((eq 'del (cadr action)) del-action)
 					((eq 'add (cadr action)) add-action)
-					(t set-action))))
+					((eq 'set (cadr action)) set-action))))
       nil)))
 
 (defun nnmaildir-close-group (gname &optional server)
--- a/lisp/gnus/nnml.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/nnml.el	Fri Nov 26 02:11:40 2010 +0000
@@ -1033,19 +1033,7 @@
   (nnml-possibly-change-directory group server)
   (unless nnml-marks-is-evil
     (nnml-open-marks group server)
-    (dolist (action actions)
-      (let ((range (nth 0 action))
-	    (what  (nth 1 action))
-	    (marks (nth 2 action)))
-	(assert (or (eq what 'add) (eq what 'del)) nil
-		"Unknown request-set-mark action: %s" what)
-	(dolist (mark marks)
-	  (setq nnml-marks (gnus-update-alist-soft
-			    mark
-			    (funcall (if (eq what 'add) 'gnus-range-add
-				       'gnus-remove-from-range)
-				     (cdr (assoc mark nnml-marks)) range)
-			    nnml-marks)))))
+    (setq nnml-marks (nnheader-update-marks-actions nnml-marks actions))
     (nnml-save-marks group server))
   nil)
 
--- a/lisp/gnus/nntp.el	Fri Nov 26 01:27:37 2010 +0000
+++ b/lisp/gnus/nntp.el	Fri Nov 26 02:11:40 2010 +0000
@@ -1118,19 +1118,7 @@
 	     nntp-marks-file-name)
     (nntp-possibly-create-directory group server)
     (nntp-open-marks group server)
-    (dolist (action actions)
-      (let ((range (nth 0 action))
-	    (what  (nth 1 action))
-	    (marks (nth 2 action)))
-	(assert (or (eq what 'add) (eq what 'del)) nil
-		"Unknown request-set-mark action: %s" what)
-	(dolist (mark marks)
-	  (setq nntp-marks (gnus-update-alist-soft
-			    mark
-			    (funcall (if (eq what 'add) 'gnus-range-add
-				       'gnus-remove-from-range)
-				     (cdr (assoc mark nntp-marks)) range)
-			    nntp-marks)))))
+    (setq nntp-marks (nnheader-update-marks-actions nntp-marks actions))
     (nntp-save-marks group server))
   nil)