From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65156 Path: news.gmane.org!not-for-mail From: Elias Oltmanns Newsgroups: gmane.emacs.gnus.general Subject: [patch] gnus-agent doesn't always synchronise flags if asked to Date: Sat, 08 Sep 2007 16:54:55 +0200 Message-ID: <874pi51a2o.fsf@denkblock.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1189263405 6075 80.91.229.12 (8 Sep 2007 14:56:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 8 Sep 2007 14:56:45 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M13669@lists.math.uh.edu Sat Sep 08 16:56:44 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1IU1jj-0003qV-SY for ding-account@gmane.org; Sat, 08 Sep 2007 16:56:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1IU1iV-0003g6-7F; Sat, 08 Sep 2007 09:55:23 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1IU1iR-0003fm-UX for ding@lists.math.uh.edu; Sat, 08 Sep 2007 09:55:19 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1IU1iO-0004dz-9p for ding@lists.math.uh.edu; Sat, 08 Sep 2007 09:55:19 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1IU1iM-00060L-00 for ; Sat, 08 Sep 2007 16:55:14 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IU1iD-0008Oh-LU for ding@gnus.org; Sat, 08 Sep 2007 16:55:05 +0200 Original-Received: from pd9e85a09.dip.t-dialin.net ([217.232.90.9]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 08 Sep 2007 16:55:05 +0200 Original-Received: from eo by pd9e85a09.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 08 Sep 2007 16:55:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 98 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pd9e85a09.dip.t-dialin.net User-Agent: Gnus/5.110007 (No Gnus v0.7) Cancel-Lock: sha1:YWRhdI2pOhNIbZHP/ptHUo6zlH8= X-Spam-Score: -2.5 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:65156 Archived-At: --=-=-= Hi all, when gnus is switched into plugged mode and any of the agentised servers is offline at the time, the user is asked whether to switch that server into online mode. However, neither then, nor when gnus actually opens a connection to that server (for instance after pressing g in the group buffer) flags are synchronised even though gnus-agent-synchronize-flags is set to t or 'ask. I suggest to call gnus-agent-possibly-synchronize-flags from gnus-open-server. Please find the patch below. Regards, Elias --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sync.patch Index: lisp/gnus-agent.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-agent.el,v retrieving revision 7.70 diff -u -r7.70 gnus-agent.el --- lisp/gnus-agent.el 14 Aug 2007 11:45:48 -0000 7.70 +++ lisp/gnus-agent.el 8 Sep 2007 14:42:49 -0000 @@ -636,8 +636,7 @@ (gnus-agent-make-mode-line-string " Plugged" 'mouse-2 'gnus-agent-toggle-plugged)) - (gnus-agent-go-online gnus-agent-go-online) - (gnus-agent-possibly-synchronize-flags)) + (gnus-agent-go-online gnus-agent-go-online)) (t (gnus-agent-close-connections) (setq gnus-plugged set-to) @@ -868,8 +867,7 @@ (interactive) (save-excursion (dolist (gnus-command-method (gnus-agent-covered-methods)) - (when (and (file-exists-p (gnus-agent-lib-file "flags")) - (eq (gnus-server-status gnus-command-method) 'ok)) + (when (eq (gnus-server-status gnus-command-method) 'ok) (gnus-agent-possibly-synchronize-flags-server gnus-command-method))))) (defun gnus-agent-synchronize-flags-server (method) @@ -905,11 +903,13 @@ (defun gnus-agent-possibly-synchronize-flags-server (method) "Synchronize flags for server according to `gnus-agent-synchronize-flags'." - (when (or (and gnus-agent-synchronize-flags - (not (eq gnus-agent-synchronize-flags 'ask))) - (and (eq gnus-agent-synchronize-flags 'ask) - (gnus-y-or-n-p (format "Synchronize flags on server `%s'? " - (cadr method))))) + (when (and (file-exists-p (gnus-agent-lib-file "flags")) + (or (and gnus-agent-synchronize-flags + (not (eq gnus-agent-synchronize-flags 'ask))) + (and (eq gnus-agent-synchronize-flags 'ask) + (gnus-y-or-n-p + (format "Synchronize flags on server `%s'? " + (cadr method)))))) (gnus-agent-synchronize-flags-server method))) ;;;###autoload Index: lisp/gnus-int.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-int.el,v retrieving revision 7.23 diff -u -r7.23 gnus-int.el --- lisp/gnus-int.el 24 Jan 2007 07:15:37 -0000 7.23 +++ lisp/gnus-int.el 8 Sep 2007 14:42:50 -0000 @@ -36,6 +36,7 @@ (autoload 'gnus-agent-expire "gnus-agent") (autoload 'gnus-agent-regenerate-group "gnus-agent") (autoload 'gnus-agent-read-servers-validate-native "gnus-agent") +(autoload 'gnus-agent-possibly-synchronize-flags-server "gnus-agent") (defcustom gnus-open-server-hook nil "Hook called just before opening connection to the news server." @@ -278,6 +279,11 @@ ;; prompting with "go offline?". This is only a concern ;; when the agent's backend fails to open the server. (gnus-open-server gnus-command-method)) + (when (and (eq (cadr elem) 'ok) gnus-agent + (gnus-agent-method-p gnus-command-method)) + (save-excursion + (gnus-agent-possibly-synchronize-flags-server + gnus-command-method))) result))))) (defun gnus-close-server (gnus-command-method) --=-=-=--