From 60c2bb4a202d55ae2345d3552f97c99a23bdcf76 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Sat, 25 Sep 2004 07:17:01 +0000 Subject: [PATCH] Synch to No Gnus 200409250605. --- lisp/ChangeLog | 20 ++++++++++++++++++++ lisp/gnus-agent.el | 32 ++++++++++++++++++++++++-------- lisp/gnus-util.el | 2 +- lisp/nnagent.el | 11 ++++++++--- 4 files changed, 53 insertions(+), 12 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 83aae3c..09c2500 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2004-09-25 Kevin Greiner + + * gnus-agent.el (gnus-agent-possibly-synchronize-flags): Ignore + servers that are offline. Avoids having gnus-agent-toggle-plugged + first ask if you want to open a server and then, even when you + responded with no, asking if you want to synchronize the server's + flags. + (gnus-agent-synchronize-flags-server): Rewrote read loop to handle + multi-line expressions. + (gnus-agent-synchronize-group-flags): New internal function. + Updates marks in memory (in the info structure) AND in the + backend. + + * gnus-util.el (gnus-remassoc): Fixed typo in documentation. + + * nnagent.el (nnagent-request-set-mark): Use + gnus-agent-synchronize-group-flags, not backend's request-set-mark + method, to ensure that synchronization updates marks in the + backend and in the info (in memory) structure. + 2004-09-24 Katsumi Yamaoka * gnus-uu.el (gnus-uu-digest-mail-forward): Obey the process/prefix diff --git a/lisp/gnus-agent.el b/lisp/gnus-agent.el index ca0ea7a..020ae83 100644 --- a/lisp/gnus-agent.el +++ b/lisp/gnus-agent.el @@ -830,7 +830,8 @@ be a select method." (interactive) (save-excursion (dolist (gnus-command-method (gnus-agent-covered-methods)) - (when (file-exists-p (gnus-agent-lib-file "flags")) + (when (and (file-exists-p (gnus-agent-lib-file "flags")) + (not (eq (gnus-server-status gnus-command-method) 'offline))) (gnus-agent-possibly-synchronize-flags-server gnus-command-method))))) (defun gnus-agent-synchronize-flags-server (method) @@ -849,13 +850,18 @@ be a select method." (gnus-message 1 "Couldn't open server %s" (nth 1 gnus-command-method))) (t - (while (not (eobp)) - (if (null (eval (read (current-buffer)))) - (gnus-delete-line) - (write-file (gnus-agent-lib-file "flags")) - (error "Couldn't set flags from file %s" - (gnus-agent-lib-file "flags")))) - (delete-file (gnus-agent-lib-file "flags")))) + (condition-case err + (while t + (let ((bgn (point))) + (eval (read (current-buffer))) + (delete-region bgn (point)))) + (end-of-file + (delete-file (gnus-agent-lib-file "flags"))) + (error + (let ((file (gnus-agent-lib-file "flags"))) + (write-file file) + (error "Couldn't set flags from file %s due to %s" + file (error-message-string err))))))) (kill-buffer nil)))) (defun gnus-agent-possibly-synchronize-flags-server (method) @@ -1211,6 +1217,16 @@ This can be added to `gnus-select-article-hook' or ;;; Internal functions ;;; +(defun gnus-agent-synchronize-group-flags (group action server) +"Update a plugged group by performing the indicated action." + (let* ((gnus-command-method (gnus-server-to-method server)) + (info (gnus-get-info group))) + (gnus-request-set-mark group action) + + (when info + (gnus-request-update-info info gnus-command-method)) + nil)) + (defun gnus-agent-save-active (method) (when (gnus-agent-method-p method) (let* ((gnus-command-method method) diff --git a/lisp/gnus-util.el b/lisp/gnus-util.el index b01d06c..89eff57 100644 --- a/lisp/gnus-util.el +++ b/lisp/gnus-util.el @@ -1202,7 +1202,7 @@ is run." "Delete by side effect any elements of LIST whose car is `equal' to KEY. The modified LIST is returned. If the first member of LIST has a car that is `equal' to KEY, there is no way to remove it -by side effect; therefore, write `(setq foo (remassoc key foo))' to be +by side effect; therefore, write `(setq foo (gnus-remassoc key foo))' to be sure of changing the value of `foo'." (when alist (if (equal key (caar alist)) diff --git a/lisp/nnagent.el b/lisp/nnagent.el index 21b9f97..2a9f52e 100644 --- a/lisp/nnagent.el +++ b/lisp/nnagent.el @@ -122,9 +122,14 @@ (deffoo nnagent-request-set-mark (group action server) (with-temp-buffer - (insert (format "(%s-request-set-mark \"%s\" '%s \"%s\")\n" - (nth 0 gnus-command-method) group action - (or server (nth 1 gnus-command-method)))) + (insert "(gnus-agent-synchronize-group-flags \"" + group + "\" '") + (gnus-pp action) + (insert " \"" + (gnus-method-to-server gnus-command-method) + "\"") + (insert ")\n") (append-to-file (point-min) (point-max) (gnus-agent-lib-file "flags"))) nil) -- 1.7.10.4