bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP)


From: Andrew Cohen
Subject: bug#54158: 28.0.91; duplicate mail downloads in Gnus (IMAP)
Date: Sat, 19 Mar 2022 12:53:52 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

(I sent this to Roland directly since I'm a bit shy about communicating
on public lists, but here goes anyway)

I think the problem is that the code in mail-source-fetch-imap doesn't
handle a list of mailboxes properly (I don't know why it would have
worked in emacs-27 though). Adam added a loop over a list of mailboxes
way back in 2015, but it seems to me that some of the variables bound
outside the loop should be bound inside (imap usually works on a per
mailbox basis)

So I think this might fix it (although I don't have a setup available to
test it).

Of course I might be totally off-base. If so, sorry in advance. 

diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 5d0c0e2654..01cca831f2 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -1066,9 +1066,7 @@ mail-source-fetch-imap
     (let ((from (format "%s:%s:%s" server user port))
          (found 0)
          (buf (generate-new-buffer " *imap source*"))
-         (mail-source-string (format "imap:%s:%s" server mailbox))
-         (imap-shell-program (or (list program) imap-shell-program))
-         remove)
+         (imap-shell-program (or (list program) imap-shell-program)))
       (if (and (imap-open server port stream authentication buf)
               (imap-authenticate
                user (or (cdr (assoc from mail-source-password-cache))
@@ -1078,7 +1076,8 @@ mail-source-fetch-imap
             (dolist (mailbox mailbox-list)
               (when (imap-mailbox-select mailbox nil buf)
          (let ((coding-system-for-write mail-source-imap-file-coding-system)
-               str)
+                (mail-source-string (format "imap:%s:%s" server mailbox))
+               str remove)
             (message "Fetching from %s..." mailbox)
            (with-temp-file mail-source-crash-box
              ;; Avoid converting 8-bit chars from inserted strings to


-- 
Andrew Cohen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]