From 3414d5de2c4ad4bf82955d69797b6639e9d19842 Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Thu, 19 Apr 2018 13:51:07 -0700 Subject: [PATCH] Add $browser_abbreviate_mailboxes. This allows '=' and '~' mailboxes shortcuts to be turned off in the browser mailbox list. The default $sort_browser value of "alpha" uses strcoll(3), which ignores some punctuation. When using multiple accounts with dynamically changing values of $folder, this can lead to an unintuitive sorting order. (See issue #22 for an example.) This problem came about because of commit 8328ce68, which enabled mutt_pretty_mailbox() calls for IMAP and POP mailboxes too. The commit had a valid point about consistency and too-wide mailbox listings, so I don't really want to revert it. This option provides an alternative to completely enable/disable the shortcuts for those who run into an issue. --- browser.c | 3 ++- init.h | 13 +++++++++++++ options.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/browser.c b/browser.c index 5f1b647fe..e1e29b094 100644 --- a/browser.c +++ b/browser.c @@ -889,7 +889,8 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state) char buffer[LONG_STRING]; mutt_str_strfcpy(buffer, tmp->path, sizeof(buffer)); - mutt_pretty_mailbox(buffer, sizeof(buffer)); + if (BrowserAbbreviateMailboxes) + mutt_pretty_mailbox(buffer, sizeof(buffer)); #ifdef USE_IMAP if (mx_is_imap(tmp->path)) diff --git a/init.h b/init.h index 37e43ebba..0eda8ca37 100644 --- a/init.h +++ b/init.h @@ -380,6 +380,19 @@ struct Option MuttVars[] = { ** follow these menus. The option is \fIunset\fP by default because many ** visual terminals don't permit making the cursor invisible. */ + { "browser_abbreviate_mailboxes", DT_BOOL, R_NONE, &BrowserAbbreviateMailboxes, 1 }, + /* + ** .pp + ** When this variable is \fIset\fP, mutt will abbreviate mailbox + ** names in the browser mailbox list, using '~' and '=' + ** shortcuts. + ** .pp + ** The default \fC"alpha"\fP setting of $$sort_browser uses + ** locale-based sorting (using \fCstrcoll(3)\fP), which ignores some + ** punctuation. This can lead to some situations where the order + ** doesn't make intuitive sense. In those cases, it may be + ** desirable to \fIunset\fP this variable. + */ #ifdef USE_NNTP { "catchup_newsgroup", DT_QUAD, R_NONE, &CatchupNewsgroup, MUTT_ASKYES }, /* diff --git a/options.h b/options.h index 892763b7e..41c4f116c 100644 --- a/options.h +++ b/options.h @@ -76,6 +76,7 @@ WHERE bool Beep; WHERE bool BeepNew; WHERE bool BounceDelivered; WHERE bool BrailleFriendly; +WHERE bool BrowserAbbreviateMailboxes; WHERE bool ChangeFolderNext; WHERE bool CheckMboxSize; WHERE bool CheckNew; -- 2.40.0