Skip to content

Commit

Permalink
Sort & group sorting methods
Browse files Browse the repository at this point in the history
  • Loading branch information
gahr authored and flatcap committed Oct 14, 2020
1 parent ba6de6d commit e455f2d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
1 change: 0 additions & 1 deletion config/sort2.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
struct ConfigSet;

extern const struct Mapping SortAliasMethods[];
extern const struct Mapping SortAuxMethods[];
extern const struct Mapping SortBrowserMethods[];
extern const struct Mapping SortKeyMethods[];
extern const struct Mapping SortMethods[];
Expand Down
17 changes: 11 additions & 6 deletions docs/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -4126,18 +4126,18 @@
** Specifies how to sort mailbox entries in the sidebar. By default, the
** entries are sorted alphabetically. Valid values:
** .il
** .dd alpha (alphabetically)
** .dd path (alphabetically)
** .dd count (all message count)
** .dd flagged (flagged message count)
** .dd name (alphabetically)
** .dd new (unread message count)
** .dd path (alphabetically)
** .dd unread (unread message count)
** .dd unsorted
** .ie
** .pp
** You may optionally use the "reverse-" prefix to specify reverse sorting
** order (example: "\fCset sidebar_sort_method=reverse-alpha\fP").
** .pp
** The "alpha" and "name" values are synonyms for "path".
*/

{ "sidebar_visible", DT_BOOL, false },
Expand Down Expand Up @@ -4595,21 +4595,24 @@
** Specifies how to sort messages in the "index" menu. Valid values
** are:
** .il
** .dd date or date-sent
** .dd date
** .dd date-received
** .dd from
** .dd mailbox-order (unsorted)
** .dd score
** .dd size
** .dd spam
** .dd subject
** .dd threads
** .dd to
** .dd unsorted
** .ie
** .pp
** You may optionally use the "reverse-" prefix to specify reverse sorting
** order.
** .pp
** The "date-sent" value is a synonim for "date". The "mailbox-order" value is
** a synonym for "unsorted".
** .pp
** Example:
** .ts
** set sort=reverse-date-sent
Expand Down Expand Up @@ -4640,7 +4643,7 @@
** When sorting by threads, this variable controls how threads are sorted
** in relation to other threads, and how the branches of the thread trees
** are sorted. This can be set to any value that $$sort can, except
** "threads" (in that case, NeoMutt will just use "date-sent"). You can also
** "threads" (in that case, NeoMutt will just use "date"). You can also
** specify the "last-" prefix in addition to the "reverse-" prefix, but "last-"
** must come after "reverse-". The "last-" prefix causes messages to be
** sorted against its siblings by which has the last descendant, using
Expand Down Expand Up @@ -4675,6 +4678,8 @@
** .pp
** You may optionally use the "reverse-" prefix to specify reverse sorting
** order (example: "\fCset sort_browser=reverse-date\fP").
** .pp
** The "unread" value is a synonym for "new".
*/

{ "sort_re", DT_BOOL, true },
Expand Down
8 changes: 5 additions & 3 deletions mutt_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,17 @@ bool C_IgnoreLinearWhiteSpace = false;
const struct Mapping SortAuxMethods[] = {
// clang-format off
{ "date", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "date-sent", SORT_DATE },
{ "threads", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
{ "spam", SORT_SPAM },
{ "subject", SORT_SUBJECT },
{ "threads", SORT_DATE },
{ "to", SORT_TO },
{ NULL, 0 },
// clang-format on
Expand All @@ -104,10 +105,11 @@ const struct Mapping SortAuxMethods[] = {
const struct Mapping SortMethods[] = {
// clang-format off
{ "date", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "date-sent", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
Expand Down
6 changes: 3 additions & 3 deletions sidebar/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
*/
const struct Mapping SortSidebarMethods[] = {
// clang-format off
{ "path", SORT_PATH },
{ "alpha", SORT_PATH },
{ "name", SORT_PATH },
{ "count", SORT_COUNT },
{ "desc", SORT_DESC },
{ "flagged", SORT_FLAGGED },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "name", SORT_PATH },
{ "new", SORT_UNREAD },
{ "path", SORT_PATH },
{ "unread", SORT_UNREAD },
{ "unsorted", SORT_ORDER },
{ NULL, 0 },
// clang-format on
};
Expand Down
3 changes: 2 additions & 1 deletion test/config/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ static struct Mapping MboxTypeMap[] = {
*/
const struct Mapping SortMangoMethods[] = {
{ "date", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "date-sent", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
Expand Down
3 changes: 2 additions & 1 deletion test/config/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ static struct Mapping MboxTypeMap[] = {
*/
static const struct Mapping SortMangoMethods[] = {
{ "date", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "date-sent", SORT_DATE },
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
Expand Down
1 change: 1 addition & 0 deletions test/config/sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const struct Mapping SortTestMethods[] = {
{ "date-received", SORT_RECEIVED },
{ "from", SORT_FROM },
{ "label", SORT_LABEL },
{ "unsorted", SORT_ORDER },
{ "mailbox-order", SORT_ORDER },
{ "score", SORT_SCORE },
{ "size", SORT_SIZE },
Expand Down

0 comments on commit e455f2d

Please sign in to comment.