]> granicus.if.org Git - mutt/commitdiff
Add $browser_abbreviate_mailboxes.
authorKevin McCarthy <kevin@8t8.us>
Thu, 19 Apr 2018 20:51:07 +0000 (13:51 -0700)
committerKevin McCarthy <kevin@8t8.us>
Thu, 19 Apr 2018 20:51:07 +0000 (13:51 -0700)
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
init.h
mutt.h

index 5d4d256e21ef8f4bc930191682a862553a750500..cb28a3a32e2ba5bd395323a158f305b493ebdc04 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -495,7 +495,8 @@ static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state)
     }
 
     strfcpy (buffer, NONULL (tmp->path), sizeof (buffer));
-    mutt_pretty_mailbox (buffer, sizeof (buffer));
+    if (option (OPTBROWSERABBRMAILBOXES))
+      mutt_pretty_mailbox (buffer, sizeof (buffer));
 
 #ifdef USE_IMAP
     if (mx_is_imap (tmp->path))
diff --git a/init.h b/init.h
index 5e79786c2ebfa810edbc33b30a1698e1290da6e3..7d55aa409cd4d268f455e413ca0d2dd3e7238819 100644 (file)
--- a/init.h
+++ b/init.h
@@ -359,6 +359,19 @@ struct option_t 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, OPTBROWSERABBRMAILBOXES, 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.
+  */
 #if defined(USE_SSL)
   { "certificate_file",        DT_PATH, R_NONE, UL &SslCertFile, UL "~/.mutt_certificates" },
   /*
diff --git a/mutt.h b/mutt.h
index 7372a51006c1b55beed76936bdd56084d6cecd0a..7c5af17363e2f1291ba21c42de39670df8fbc5fb 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -358,6 +358,7 @@ enum
   OPTBOUNCEDELIVERED,
   OPTCHANGEFOLDERNEXT,
   OPTBRAILLEFRIENDLY,
+  OPTBROWSERABBRMAILBOXES,
   OPTCHECKMBOXSIZE,
   OPTCHECKNEW,
   OPTCOLLAPSEUNREAD,