This patch is from Ian Zimmerman, on the mutt-users mailing list: see Sun, 7 Jun 2015 "File browser oddity". I'm made a couple modifications, detailed below.
The change could be controversial, so I'd appreciate discussion before I consider pushing this. When changing mailboxes, mutt currently displays all the files instead of subscribed mailboxes by default (the buffy parameter is ignored). The patch changes it so that the "buffy" parameters to _mutt_enter_fname() is used to enable M_SEL_BUFFY flag for _mutt_select_file(). Callers currently appear to correctly pass in buffy based on whether they expect to browse files or mailboxes. Two other changes are necessitated are by the patch. First, the "y" macro inside doc/Muttrc no longer needs to <toggle-mailboxes>. Second, the current behavior of the file browser is to abort if there are no mailboxes defined. This would prevent the user from invoking <toggle-mailboxes>, so the abort is removed (and an empty file browser is displayed). A huge concern with this patch is changing long-standing behavior. Another concern is the behavior when no mailboxes are defined. Even though it no longer aborts, an empty list could be confusing to new users, who may not know to press Tab. Overall I think the patch makes sense. However, the above concerns make me nervous. I'd really need more feedback (of the affirmative kind) before pushing this. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch # User Kevin McCarthy <[email protected]> # Date 1433802324 25200 # Mon Jun 08 15:25:24 2015 -0700 # Node ID b4df49dea05c7ec92cbfc0dddab6124344511be2 # Parent 17a4f92e4a95d0225ce120b72597e8b72294a8ad Browse mailboxes by default when changing folders. Currently, when changing folders, the "buffy" paramater to _mutt_enter_fname() is ignored when "?" is pressed. This means the browser will show files instead of mailboxes by default. The patch: * enables the M_SEL_BUFFY flag when buffy is true. * modifies the 'y' macro to not toggle mailboxes anymore. * enables the file browser to continue running, even if there are no mailboxes defined. Otherwise, the user would have no opportunity to toggle-mailboxes themself. Thanks to Ian Zimmerman for the original patch. diff --git a/browser.c b/browser.c --- a/browser.c +++ b/browser.c @@ -443,22 +443,22 @@ { struct stat s; char buffer[LONG_STRING]; BUFFY *tmp = Incoming; #ifdef USE_IMAP struct mailbox_state mbox; #endif + init_state (state, menu); + if (!Incoming) return (-1); mutt_buffy_check (0); - init_state (state, menu); - do { #ifdef USE_IMAP if (mx_is_imap (tmp->path)) { imap_mailbox_state (tmp->path, &mbox); add_folder (menu, state, tmp->path, NULL, mbox.new); continue; @@ -662,18 +662,17 @@ getcwd (LastDir, sizeof (LastDir)); } } *f = 0; if (buffy) { - if (examine_mailboxes (NULL, &state) == -1) - goto bail; + examine_mailboxes (NULL, &state); } else #ifdef USE_IMAP if (!state.imap_browse) #endif if (examine_directory (NULL, &state, LastDir, prefix) == -1) goto bail; @@ -1175,18 +1174,17 @@ case OP_CHECK_NEW: destroy_state (&state); prefix[0] = 0; killPrefix = 0; if (buffy) { - if (examine_mailboxes (menu, &state) == -1) - goto bail; + examine_mailboxes (menu, &state); } #ifdef USE_IMAP else if (mx_is_imap (LastDir)) { init_state (&state, NULL); state.imap_browse = 1; imap_browse (LastDir, &state); browser_sort (&state); diff --git a/curs_lib.c b/curs_lib.c --- a/curs_lib.c +++ b/curs_lib.c @@ -561,16 +561,17 @@ } return rc; } int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, int *redraw, int buffy, int multiple, char ***files, int *numfiles) { event_t ch; + int flags; SETCOLOR (MT_COLOR_PROMPT); mvaddstr (LINES-1, 0, (char *) prompt); addstr (_(" ('?' for list): ")); NORMAL_COLOR; if (buf[0]) addstr (buf); clrtoeol (); @@ -581,18 +582,22 @@ { CLEARLINE (LINES-1); return (-1); } else if (ch.ch == '?') { mutt_refresh (); buf[0] = 0; - _mutt_select_file (buf, blen, M_SEL_FOLDER | (multiple ? M_SEL_MULTI : 0), - files, numfiles); + flags = M_SEL_FOLDER; + if (multiple) + flags |= M_SEL_MULTI; + if (buffy) + flags |= M_SEL_BUFFY; + _mutt_select_file (buf, blen, flags, files, numfiles); *redraw = REDRAW_FULL; } else { char *pc = safe_malloc (mutt_strlen (prompt) + 3); sprintf (pc, "%s: ", prompt); /* __SPRINTF_CHECKED__ */ mutt_ungetch (ch.op ? 0 : ch.ch, ch.op ? ch.op : 0); diff --git a/doc/Muttrc.head b/doc/Muttrc.head --- a/doc/Muttrc.head +++ b/doc/Muttrc.head @@ -21,17 +21,17 @@ <pipe-message> urlview<Enter>\ <enter-command> set pipe_decode=\$my_pipe_decode; unset my_pipe_decode<Enter>" \ "call urlview to extract URLs out of a message" # Show documentation when pressing F1 macro generic,pager <F1> "<shell-escape> less @docdir@/manual.txt<Enter>" "show Mutt documentation" # show the incoming mailboxes list (just like "mutt -y") and back when pressing "y" -macro index,pager y "<change-folder>?<toggle-mailboxes>" "show incoming mailboxes list" +macro index,pager y "<change-folder>?" "show incoming mailboxes list" bind browser y exit # If Mutt is unable to determine your site's domain name correctly, you can # set the default here. # # set hostname=cs.hmc.edu # If your sendmail supports the -B8BITMIME flag, enable the following
signature.asc
Description: PGP signature
