From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67049 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.gnus.general Subject: patch for nnimap.el: make sure mailbox is unselected before deletion Date: Thu, 12 Jun 2008 09:45:04 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213283583 13012 80.91.229.12 (12 Jun 2008 15:13:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Jun 2008 15:13:03 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M15516@lists.math.uh.edu Thu Jun 12 17:13:43 2008 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 1K6oUR-00045M-Fn for ding-account@gmane.org; Thu, 12 Jun 2008 17:13:27 +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 1K6oS7-0006wy-Lh; Thu, 12 Jun 2008 10:11:03 -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 1K6hUn-0004kn-Ph for ding@lists.math.uh.edu; Thu, 12 Jun 2008 02:45:21 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1K6hUh-0005xx-6x for ding@lists.math.uh.edu; Thu, 12 Jun 2008 02:45:21 -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 1K6hUw-0006Xn-00 for ; Thu, 12 Jun 2008 09:45:30 +0200 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1K6hUd-0005do-V6 for ding@gnus.org; Thu, 12 Jun 2008 07:45:11 +0000 Original-Received: from kafka.physik3.gwdg.de ([134.76.92.48]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Jun 2008 07:45:11 +0000 Original-Received: from deng by kafka.physik3.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 12 Jun 2008 07:45:11 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 55 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: kafka.physik3.gwdg.de User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:jxsGkyztHcPDzhQonbyQ8zGHw3c= X-Spam-Score: -2.6 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67049 Archived-At: nnmairix sometimes triggers an error in nnimap when it deletes and immediately re-creates a group on the server and checks it for mail. nnimap seems to think the mailbox is still selected, leading to a "No mailbox selected" error in the imap back end. The following patch makes sure the mailbox is unselected before deletion, which circumvents this error: --- nnimap.el 2008-06-10 11:20:33.000000000 +0200 +++ nnimap-patched.el 2008-06-10 11:13:25.000000000 +0200 @@ -1609,6 +1609,8 @@ (deffoo nnimap-request-delete-group (group force &optional server) (when (nnimap-possibly-change-server server) + (when (string= group (imap-current-mailbox nnimap-server-buffer)) + (imap-mailbox-unselect nnimap-server-buffer)) (with-current-buffer nnimap-server-buffer (if force (or (null (imap-mailbox-status group 'uidvalidity)) Here is an example from the IMAP log when this error occurs: - check zz_mairix-cron-3 for mail, so that mailbox is selected 500 SELECT "zz_mairix-cron-3" * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted. * 118 EXISTS * 0 RECENT * OK [UIDVALIDITY 1213024279] UIDs valid * OK [UIDNEXT 122] Predicted next UID 500 OK [READ-WRITE] Select completed. 501 FETCH 1,* UID * 1 FETCH (UID 1) * 118 FETCH (UID 121) 501 OK Fetch completed. - delete and re-create group and check for mail 503 STATUS "zz_mairix-cron-3" (UIDVALIDITY) * STATUS "zz_mairix-cron-3" (UIDVALIDITY 1213024279) 503 OK Status completed. 504 DELETE "zz_mairix-cron-3" 504 OK Delete completed. 505 STATUS "zz_mairix-cron-3" (UIDVALIDITY) 505 NO Mailbox doesn't exist: zz_mairix-cron-3 506 CREATE "zz_mairix-cron-3" 506 OK Create completed. 507 NOOP 507 OK NOOP completed. 508 FETCH 1,* UID 508 BAD No mailbox selected. Regards, David