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.
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.
(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>
(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.
(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)
(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))
(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.
(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)
(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)
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)