Under Development
stars

Use Threads πŸ”₯#

Since: NeoMutt 2021-08-01

Introduction#

The β€œUse Threads” feature adds a new config option to allow more precise control of how threads are displayed in the index. Whether threads are in use is now orthogonal from how messages are sorted.

Functions#

The β€œUse Threads” feature adds no new functions to NeoMutt. The existing functions <sort-mailbox> and <sort-reverse> are updated to toggle the state of $use_threads once it has been set, while preserving backwards-compatible behavior on $sort if this feature is not used.

Variables#

The β€œUse Threads” feature adds one new config option, $use_threads, which is an enumeration of possible thread views. The variable defaults to unset for the original behavior of overloading $sort=threads to enable sorting. It can be set to flat (or no) for an unthreaded view based on $sort, to threads (or yes) for a threaded view where roots appear above children, or to reverse for a threaded view where children appear above roots.

When sorting by threads, the value of $sort determines which thread floats to the top. If $sort does not contain reverse-, the latest thread goes to the bottom for use_threads=threads and to the top for use_threads=reverse; the direction of float is swapped if $sort also uses reverse-. If $sort includes last-, the overall thread is sorted by its descendant at any depth which would sort last in a flat view; otherwise, the overall thread is sorted solely by the thread root. The last- prefix is ignored when use_threads=flat.

Within a single thread, the value of $sort_aux determines how siblings are sorted. The same prefixes apply as for $sort, although it is less common to use the last- prefix.

The β€œUse Threads” feature also modifies the existing config option $status_format, adding the %T expando which shows the current threading method.

Use Threads Variable#

Flat View

Flat View
12:01  Anne       cover letter for thread 1                                                         
12:02  Anne       part 1 of thread 1                                                                
12:03  Anne       part 2 of thread 1                                                                
12:04  Anne       part 3 of thread 1                                                                
12:05  Barbara    thread 2                                                                          
12:06  Claire     thread 3                                                                          
12:07  Diane      re: part 2 of thread 1                                                            
12:08  Erica      re: thread 2                                                                      
# Default configuration: flat view sorted by date
# selecting threads with <sort-mailbox> changes $sort
# set use_threads=unset sort=date sort_aux=date
# Modern configuration: explicit flat view sorted by date
# selecting threads with <sort-mailbox> changes $use_threads
set use_threads=no sort=date sort_aux=date

Threaded View

Threaded View
12:01  Anne       cover letter for thread 1                                                         
12:02  Anne       β”œβ”€>part 1 of thread 1                                                             
12:03  Anne       β”œβ”€>part 2 of thread 1                                                             
12:07  Diane      β”‚ └─>                                                                             
12:04  Anne       └─>part 3 of thread 1                                                             
12:05  Barbara    thread 2                                                                          
12:08  Erica      └─>                                                                               
12:06  Claire     thread 3                                                                          
# Legacy configuration: sorting threads by date started
# set sort=threads sort_aux=date
# Modern configuration for the same
# Latest root message sorts last
set use_threads=yes sort=date sort_aux=date

Reverse Threaded View

Reverse Threaded View
12:06  Claire     thread 3                                                                          
12:08  Erica      β”Œβ”€>                                                                               
12:05  Barbara    thread 2                                                                          
12:04  Anne       β”Œβ”€>part 3 of thread 1                                                             
12:07  Diane      β”‚ β”Œβ”€>                                                                             
12:03  Anne       β”œβ”€>part 2 of thread 1                                                             
12:02  Anne       β”œβ”€>part 1 of thread 1                                                             
12:01  Anne       cover letter for thread 1                                                         
# Legacy configuration: display threads upside-down
# set sort=reverse-threads sort_aux=date
# Modern configuration for the same
# Latest root message sorts first
set use_threads=reverse sort=date sort_aux=date

Recently Active First

Recently Active First
12:05  Barbara    thread 2                                                                          
12:08  Erica      └─>                                                                               
12:01  Anne       cover letter for thread 1                                                         
12:03  Anne       β”œβ”€>part 2 of thread 1                                                             
12:07  Diane      β”‚ └─>                                                                             
12:04  Anne       β”œβ”€>part 3 of thread 1                                                             
12:02  Anne       └─>part 1 of thread 1                                                             
12:06  Claire     thread 3                                                                          
# Legacy configuration: recently active thread/subthread first
# set sort=threads sort_aux=reverse-last-date
# Modern configuration for the same
# Note that subthreads are also rearranged
set use_threads=threads sort=reverse-last-date sort_aux=reverse-last-date

Recently Active Last

Recently Active Last
12:06  Claire     thread 3                                                                          
12:01  Anne       cover letter for thread 1                                                         
12:02  Anne       β”œβ”€>part 1 of thread 1                                                             
12:03  Anne       β”œβ”€>part 2 of thread 1                                                             
12:07  Diane      β”‚ └─>                                                                             
12:04  Anne       └─>part 3 of thread 1                                                             
12:05  Barbara    thread 2                                                                          
12:08  Erica      └─>                                                                               
# Modern configuration: threads keep date order, recently active thread last
# (not possible with legacy configuration)
set use_threads=threads sort=last-date sort_aux=date

πŸ“· Screenshot Needed

Subject: Flat vs threaded vs reverse threading modes

Description: Three NeoMutt index views of the same mailbox: (1) use_threads=no showing flat chronological order, (2) use_threads=yes showing threaded view with tree characters and roots above children, (3) use_threads=reverse showing inverted threads with children above roots.

Highlights: The difference in message ordering and the tree-drawing characters (|->, `->, ,->) β€” particularly how the same messages appear in completely different positions depending on the threading mode.

Known Bugs#

Even though use_threads accepts the values yes and no, it does not behave like a boolean or quad-option variable. A bare set use_threads performs a query rather than setting it to yes, and the variable is not usable with toggle.

Credits#

Eric Blake