]> granicus.if.org Git - neomutt/commitdiff
sidebar: extend sidebar sort methods, add sort_sidebar=
authorKarel Zak <kzak@redhat.com>
Mon, 17 Sep 2012 07:31:54 +0000 (09:31 +0200)
committerRichard Russon <rich@flatcap.org>
Mon, 14 Mar 2016 23:11:42 +0000 (23:11 +0000)
 sort_sidebar=(desc|path|count|new|unsorted)

Signed-off-by: Karel Zak <kzak@redhat.com>
README.notmuch
init.h
sidebar.c

index 701fbb912020e4d32628cc1c34ebc0b8a9dc7bd0..ba525ec3df142c61175dbdebd12edbb443b4601a 100644 (file)
@@ -123,7 +123,8 @@ notmuch support for mutt
    virtual-mailboxes <description> <uri> [ ...]
 
       This command specifies one or more virtual folder. The folders are
-      accessioble by command 'X'.
+      accessible by command 'X'. It's possible to use the virtual mailbox
+      description as a sort key (e.g set sort_sidebar=desc)
 
       example:
 
@@ -245,6 +246,7 @@ notmuch support for mutt
        # sidebar
        set sidebar_width       = 35
        set sidebar_visible     = yes
+        set sort_sidebar        = unsorted
        color sidebar_new yellow default
        bind index <left> sidebar-prev
        bind index <right> sidebar-next
diff --git a/init.h b/init.h
index 8df5bfbea4c7dad87f6ecfdf93b25eecec26cee0..dd283527229fe1e169dbb0fff8942beee40027d8 100644 (file)
--- a/init.h
+++ b/init.h
@@ -3178,14 +3178,15 @@ struct option_t MuttVars[] = {
   { "sort_re",         DT_BOOL, R_INDEX|R_RESORT|R_RESORT_INIT, OPTSORTRE, 1 },
   /*
   ** .pp
-  ** This variable is only useful when sorting by threads with
-  ** $$strict_threads \fIunset\fP.  In that case, it changes the heuristic
-  ** mutt uses to thread messages by subject.  With $$sort_re \fIset\fP, mutt will
-  ** only attach a message as the child of another message by subject if
-  ** the subject of the child message starts with a substring matching the
-  ** setting of $$reply_regexp.  With $$sort_re \fIunset\fP, mutt will attach
-  ** the message whether or not this is the case, as long as the
-  ** non-$$reply_regexp parts of both messages are identical.
+  ** This variable is only useful when sorting by mailboxes in sidebar. By default,
+  ** entries are unsorted.  Valid values:
+  ** .il
+  ** .dd count (all message count)
+  ** .dd desc  (virtual mailbox description)
+  ** .dd new (new message count)
+  ** .dd path
+  ** .dd unsorted
+  ** .ie
   */
   { "spam_separator",   DT_STR, R_NONE, UL &SpamSep, UL "," },
   /*
@@ -3812,6 +3813,7 @@ const struct mapping_t SortKeyMethods[] = {
 
 const struct mapping_t SortSidebarMethods[] = {
   { "count",   SORT_COUNT },
+  { "desc",    SORT_DESC },
   { "flagged", SORT_FLAGGED },
   { "new",     SORT_COUNT_NEW },
   { "path",    SORT_PATH },
index 35aeb6f899ffb0bd680a2535c8ce035ae427c2d1..714795a1fd0bf86c13e7e3537410109030486df6 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -363,6 +363,9 @@ cb_qsort_buffy (const void *a, const void *b)
                case SORT_COUNT_NEW:
                        result = (b2->msg_unread - b1->msg_unread);
                        break;
+               case SORT_DESC:
+                       result = mutt_strcmp (b1->desc, b2->desc);
+                       break;
                case SORT_FLAGGED:
                        result = (b2->msg_flagged - b1->msg_flagged);
                        break;