diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 43c623ff..ec58212d 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -434,6 +434,19 @@ date. The formats used for date and time are (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) "Get some identifier for the mailing 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; ;; so limit subject length to 600 (truncate-string-to-width val 600))) + (:thread-subject (mu4e~headers-thread-subject msg)) ((:maildir :path :message-id) val) ((:to :from :cc :bcc) (mu4e~headers-contact-str val)) ;; if we (ie. `user-mail-address' is the 'From', show diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index c24563e1..8ddcbd0e 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -658,6 +658,11 @@ mu4e-compose-mode." :shortname "Tags" :help "Tags for the message" :sortable nil)) + (:thread-subject . + ( :name "Subject" + :shortname "Subject" + :help "Subject of the thread" + :sortable :subject)) (:to . ( :name "To" :shortname "T" diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index 679a613c..239df84b 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -779,11 +779,15 @@ the @t{:date} field instead. @code{mu4e-headers-date-format} and @code{mu4e-headers-time-format}, respectively. In the example, we use @code{:human-date}, which shows when the 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 -``@t{^}''@footnote{or you can use little graphical triangles; see variable -@code{mu4e-use-fancy-chars}}, corresponding to the sort order (descending or -ascending, respectively). You can influence this by a mouse click, or -@key{O}. Not all fields allow sorting. +``@t{^}''@footnote{or you can use little graphical triangles; see +variable @code{mu4e-use-fancy-chars}}, corresponding to the sort order +(descending or ascending, respectively). You can influence this by a +mouse click, or @key{O}. Not all fields allow sorting. @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 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. ;; These are the defaults: (setq mu4e-headers-fields - '( (:date . 25) + '( (:date . 25) ;; alternatively, use :human-date (:flags . 6) (:from . 22) - (:subject . nil))) + (:subject . nil))) ;; alternatively, use :thread-subject ;; program to get mail; alternatives are 'fetchmail', 'getmail' ;; isync or your own shellscript. called when 'U' is pressed in