From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/67048 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 15:53:35 +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 1213278874 27138 80.91.229.12 (12 Jun 2008 13:54:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Jun 2008 13:54:34 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M15515@lists.math.uh.edu Thu Jun 12 15:55:17 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 1K6nGg-0003Jo-B8 for ding-account@gmane.org; Thu, 12 Jun 2008 15:55:10 +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 1K6nFJ-0006aI-0A; Thu, 12 Jun 2008 08:53:45 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1K6nFH-0006Zh-EC for ding@lists.math.uh.edu; Thu, 12 Jun 2008 08:53:43 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1K6nFB-0006nu-Ba for ding@lists.math.uh.edu; Thu, 12 Jun 2008 08:53:43 -0500 Original-Received: from m61s02.vlinux.de ([83.151.21.164]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1K6nFS-0004pD-00 for ; Thu, 12 Jun 2008 15:53:54 +0200 Original-Received: from kafka.physik3.gwdg.de ([134.76.92.48]) by m61s02.vlinux.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K6nFB-0004ZI-Gn for ding@gnus.org; Thu, 12 Jun 2008 15:53:37 +0200 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) X-Spam-Score: -2.2 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:67048 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 [1]. 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)) By the way, I tried to post this several times in the last few days via Gmane, but it never showed up, so I use mail now. Am I the only one having this problem? Regards, David [1] 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.