From: Kevin McCarthy Date: Fri, 24 Aug 2018 19:56:54 +0000 (-0700) Subject: Display an error message if syncing fails. X-Git-Tag: mutt-1-11-rel~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa620776e3b8853294c28c5b6deb2a37e85e700f;p=mutt Display an error message if syncing fails. 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. --- diff --git a/mx.c b/mx.c index 404daef9..9d311ef8 100644 --- a/mx.c +++ b/mx.c @@ -729,13 +729,25 @@ void mx_fastclose_mailbox (CONTEXT *ctx) /* save changes to disk */ static int sync_mailbox (CONTEXT *ctx, int *index_hint) { + int rc; + if (!ctx->mx_ops || !ctx->mx_ops->sync) return -1; if (!ctx->quiet) + { + /* L10N: Displayed before/as a mailbox is being synced */ mutt_message (_("Writing %s..."), ctx->path); + } + + rc = ctx->mx_ops->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->sync (ctx, index_hint); + return rc; } /* move deleted mails to the trash folder */