mu4e: experimental :thread-subject field (one subject per thread)
with :thread-subject field, we attempt to only show one subject per thread, somewhat like mutt does it. the current implementation is straightforward, but does not take into account whether the thread-subject is currently visible on the screen, which is a bit tricky to implement
This commit is contained in:
@ -434,6 +434,19 @@ date. The formats used for date and time are
|
|||||||
(format-time-string mu4e-headers-date-format date))))))
|
(format-time-string mu4e-headers-date-format date))))))
|
||||||
|
|
||||||
|
|
||||||
|
(defsubst mu4e~headers-thread-subject (msg)
|
||||||
|
"Get the subject if it is the first one in a thread; otherwise,
|
||||||
|
return the thread-prefix without the subject-text. In other words,
|
||||||
|
show the subject of a thread only once, similar to e.g. 'mutt'."
|
||||||
|
(let ((tinfo (mu4e-message-field msg :thread))
|
||||||
|
(subj (mu4e-msg-field msg :subject)))
|
||||||
|
(concat ;; prefix subject with a thread indicator
|
||||||
|
(mu4e~headers-thread-prefix tinfo)
|
||||||
|
(if (or (zerop (plist-get tinfo :level))
|
||||||
|
(plist-get tinfo :empty-parent))
|
||||||
|
(truncate-string-to-width subj 600) ""))))
|
||||||
|
|
||||||
|
|
||||||
(defsubst mu4e~headers-mailing-list (list)
|
(defsubst mu4e~headers-mailing-list (list)
|
||||||
"Get some identifier for the mailing list."
|
"Get some identifier for the mailing list."
|
||||||
(if list
|
(if list
|
||||||
@ -467,6 +480,7 @@ if provided, or at the end of the buffer otherwise."
|
|||||||
;; work-around: emacs' display gets really slow when lines are too long;
|
;; work-around: emacs' display gets really slow when lines are too long;
|
||||||
;; so limit subject length to 600
|
;; so limit subject length to 600
|
||||||
(truncate-string-to-width val 600)))
|
(truncate-string-to-width val 600)))
|
||||||
|
(:thread-subject (mu4e~headers-thread-subject msg))
|
||||||
((:maildir :path :message-id) val)
|
((:maildir :path :message-id) val)
|
||||||
((:to :from :cc :bcc) (mu4e~headers-contact-str val))
|
((:to :from :cc :bcc) (mu4e~headers-contact-str val))
|
||||||
;; if we (ie. `user-mail-address' is the 'From', show
|
;; if we (ie. `user-mail-address' is the 'From', show
|
||||||
|
|||||||
@ -658,6 +658,11 @@ mu4e-compose-mode."
|
|||||||
:shortname "Tags"
|
:shortname "Tags"
|
||||||
:help "Tags for the message"
|
:help "Tags for the message"
|
||||||
:sortable nil))
|
:sortable nil))
|
||||||
|
(:thread-subject .
|
||||||
|
( :name "Subject"
|
||||||
|
:shortname "Subject"
|
||||||
|
:help "Subject of the thread"
|
||||||
|
:sortable :subject))
|
||||||
(:to .
|
(:to .
|
||||||
( :name "To"
|
( :name "To"
|
||||||
:shortname "T"
|
:shortname "T"
|
||||||
|
|||||||
@ -779,11 +779,15 @@ the @t{:date} field instead.
|
|||||||
@code{mu4e-headers-date-format} and @code{mu4e-headers-time-format},
|
@code{mu4e-headers-date-format} and @code{mu4e-headers-time-format},
|
||||||
respectively. In the example, we use @code{:human-date}, which shows when the
|
respectively. In the example, we use @code{:human-date}, which shows when the
|
||||||
time when the message was sent today, and the date otherwise.
|
time when the message was sent today, and the date otherwise.
|
||||||
|
@item By default, the subject is shown using the @t{:subject} field;
|
||||||
|
however, it is also possible to use @t{:thread-subject}, which shows
|
||||||
|
the subject of a thread only once, similar to the display of the
|
||||||
|
@t{mutt} e-mail client.
|
||||||
@item The header field used for sorting is indicated by ``@t{V}'' or
|
@item The header field used for sorting is indicated by ``@t{V}'' or
|
||||||
``@t{^}''@footnote{or you can use little graphical triangles; see variable
|
``@t{^}''@footnote{or you can use little graphical triangles; see
|
||||||
@code{mu4e-use-fancy-chars}}, corresponding to the sort order (descending or
|
variable @code{mu4e-use-fancy-chars}}, corresponding to the sort order
|
||||||
ascending, respectively). You can influence this by a mouse click, or
|
(descending or ascending, respectively). You can influence this by a
|
||||||
@key{O}. Not all fields allow sorting.
|
mouse click, or @key{O}. Not all fields allow sorting.
|
||||||
@item Instead of showing the @t{From:} and @t{To:} fields separately, you
|
@item Instead of showing the @t{From:} and @t{To:} fields separately, you
|
||||||
can use From/To (@t{:from-or-to} in @code{mu4e-headers-fields} as a more
|
can use From/To (@t{:from-or-to} in @code{mu4e-headers-fields} as a more
|
||||||
compact way to convey the most important information: it shows @t{From:}
|
compact way to convey the most important information: it shows @t{From:}
|
||||||
@ -2984,10 +2988,10 @@ customize.
|
|||||||
;; (better only use that for the last field.
|
;; (better only use that for the last field.
|
||||||
;; These are the defaults:
|
;; These are the defaults:
|
||||||
(setq mu4e-headers-fields
|
(setq mu4e-headers-fields
|
||||||
'( (:date . 25)
|
'( (:date . 25) ;; alternatively, use :human-date
|
||||||
(:flags . 6)
|
(:flags . 6)
|
||||||
(:from . 22)
|
(:from . 22)
|
||||||
(:subject . nil)))
|
(:subject . nil))) ;; alternatively, use :thread-subject
|
||||||
|
|
||||||
;; program to get mail; alternatives are 'fetchmail', 'getmail'
|
;; program to get mail; alternatives are 'fetchmail', 'getmail'
|
||||||
;; isync or your own shellscript. called when 'U' is pressed in
|
;; isync or your own shellscript. called when 'U' is pressed in
|
||||||
|
|||||||
Reference in New Issue
Block a user