]> granicus.if.org Git - neomutt/commitdiff
Display an error message if syncing fails
authorKevin McCarthy <kevin@8t8.us>
Fri, 24 Aug 2018 19:56:54 +0000 (12:56 -0700)
committerRichard Russon <rich@flatcap.org>
Sat, 1 Sep 2018 17:06:08 +0000 (18:06 +0100)
Ticket 36 reported an issue where a maildir was removed while the
mailbox was opened.  Later, attempting to sync displayed the message
"Writing xxx...", which remained on the screen.  The reporter actually
thought mutt was frozen, but it was simply that on a sync error Mutt
wasn't clearing or updating the message window.

There is some error message handling for mbox.c check_mailbox, but I
don't think that is the right place to further propogate messages.
Instead, add an error to the same place the initial "Writing..."
message is created.

mx.c

diff --git a/mx.c b/mx.c
index 0320c1cc6a92210bf831cf9b83a98170975082d8..27709877ca9d273cd1614e88ed81b7e6369ff6b5 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -394,9 +394,19 @@ static int sync_mailbox(struct Context *ctx, int *index_hint)
     return -1;
 
   if (!ctx->quiet)
+  {
+    /* L10N: Displayed before/as a mailbox is being synced */
     mutt_message(_("Writing %s..."), ctx->path);
+  }
+
+  int rc = ctx->mx_ops->mbox_sync(ctx, index_hint);
+  if ((rc != 0) && !ctx->quiet)
+  {
+    /* L10N: Displayed if a mailbox sync fails */
+    mutt_error(_("Unable to write %s!"), ctx->path);
+  }
 
-  return ctx->mx_ops->mbox_sync(ctx, index_hint);
+  return rc;
 }
 
 /**