From d8ca5a3d7ba95155ae1cd5970d98496ca7d48fe4 Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Cerri Date: Wed, 2 May 2018 23:04:50 -0300 Subject: [PATCH 1/3] mu4e: remove reference to mu4e-headers-new-thread-style The docs for the prefix variables mention the variable "mu4e-headers-new-thread-style" that was removed on a previous iteration. --- mu4e/mu4e-headers.el | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index f6ca97b9..3e1665ad 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -233,38 +233,26 @@ one of: `:date', `:subject', `:size', `:prio', `:from', `:to.', ;; thread prefix marks (defvar mu4e-headers-thread-child-prefix '("├>" . "┣▶ ") - "Prefix for messages in sub threads that do have a following sibling. - -This variable is only used when mu4e-headers-new-thread-style is non-nil.") + "Prefix for messages in sub threads that do have a following sibling.") (defvar mu4e-headers-thread-last-child-prefix '("└>" . "┗▶ ") - "Prefix for messages in sub threads that do not have a following sibling. - -This variable is only used when mu4e-headers-new-thread-style is non-nil.") + "Prefix for messages in sub threads that do not have a following sibling.") (defvar mu4e-headers-thread-connection-prefix '("│" . "┃ ") "Prefix to connect sibling messages that do not follow each other. -This prefix should have the same length as `mu4e-headers-thread-blank-prefix'. - -This variable is only used when mu4e-headers-new-thread-style is non-nil.") +This prefix should have the same length as `mu4e-headers-thread-blank-prefix'.") (defvar mu4e-headers-thread-blank-prefix '(" " . " ") "Prefix to separate non connected messages. -This prefix should have the same length as `mu4e-headers-thread-connection-prefix'. - -This variable is only used when mu4e-headers-new-thread-style is non-nil.") +This prefix should have the same length as `mu4e-headers-thread-connection-prefix'.") (defvar mu4e-headers-thread-orphan-prefix '("" . "") - "Prefix for orphan messages. - -This variable is only used when mu4e-headers-new-thread-style is non-nil.") + "Prefix for orphan messages.") (defvar mu4e-headers-thread-duplicate-prefix '("=" . "≡ ") - "Prefix for duplicate messages. - -This variable is only used when mu4e-headers-new-thread-style is non-nil.") + "Prefix for duplicate messages.") (defvar mu4e-headers-actions '( ("capture message" . mu4e-action-capture-message) From 26cd0a59ff4e0c58406ce01a7f77eba07a1cbf5e Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Cerri Date: Wed, 2 May 2018 23:31:33 -0300 Subject: [PATCH 2/3] mu4e: use special prefixes to describe orphan threads Re-use `mu4e-headers-thread-orphan-prefix' for the prefix for the first sibling in the orphan thread and add `mu4e-headers-thread-single-orphan-prefix' as the prefix of single orphans. --- mu4e/mu4e-headers.el | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 3e1665ad..e2700f19 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -248,8 +248,11 @@ This prefix should have the same length as `mu4e-headers-thread-blank-prefix'.") This prefix should have the same length as `mu4e-headers-thread-connection-prefix'.") -(defvar mu4e-headers-thread-orphan-prefix '("" . "") - "Prefix for orphan messages.") +(defvar mu4e-headers-thread-orphan-prefix '("┬>" . "┳▶ ") + "Prefix for orphan messages with siblings.") + +(defvar mu4e-headers-thread-single-orphan-prefix '("─>" . "━▶ ") + "Prefix for orphan messages with no siblings.") (defvar mu4e-headers-thread-duplicate-prefix '("=" . "≡ ") "Prefix for duplicate messages.") @@ -433,13 +436,14 @@ into a string." (lambda (cell) (if mu4e-use-fancy-chars (cdr cell) (car cell))))) (case type - ('child (funcall get-prefix mu4e-headers-thread-child-prefix)) - ('last-child (funcall get-prefix mu4e-headers-thread-last-child-prefix)) - ('connection (funcall get-prefix mu4e-headers-thread-connection-prefix)) - ('blank (funcall get-prefix mu4e-headers-thread-blank-prefix)) - ('orphan (funcall get-prefix mu4e-headers-thread-orphan-prefix)) - ('duplicate (funcall get-prefix mu4e-headers-thread-duplicate-prefix)) - (t "?")))) + ('child (funcall get-prefix mu4e-headers-thread-child-prefix)) + ('last-child (funcall get-prefix mu4e-headers-thread-last-child-prefix)) + ('connection (funcall get-prefix mu4e-headers-thread-connection-prefix)) + ('blank (funcall get-prefix mu4e-headers-thread-blank-prefix)) + ('orphan (funcall get-prefix mu4e-headers-thread-orphan-prefix)) + ('single-orphan (funcall get-prefix mu4e-headers-thread-single-orphan-prefix)) + ('duplicate (funcall get-prefix mu4e-headers-thread-duplicate-prefix)) + (t "?")))) ;; In order to print a thread tree with all the message connections, ;; it's necessary to keep track of all sub levels that still have @@ -478,12 +482,14 @@ into a string." ;; connections or blanks. (mapconcat (lambda (s) - (if s (mu4e~headers-thread-prefix-map 'connection) - (mu4e~headers-thread-prefix-map 'blank))) + (mu4e~headers-thread-prefix-map + (if s 'connection 'blank))) mu4e~headers-thread-state "") ;; Current entry. - (if last-child (mu4e~headers-thread-prefix-map 'last-child) - (mu4e~headers-thread-prefix-map 'child)))))) + (mu4e~headers-thread-prefix-map + (if (and empty-parent first-child) + (if last-child 'single-orphan 'orphan) + (if last-child 'last-child 'child))))))) ;; If a new sub-thread will follow (has-child) and the current ;; one is still not done (not last-child), then a new ;; connection needs to be added to the tree-state. It's not @@ -493,10 +499,8 @@ into a string." (setq mu4e~headers-thread-state (append mu4e~headers-thread-state '(t)))) ;; Return the thread prefix. - (format "%s%s%s" + (format "%s%s" prefix - (if empty-parent - (mu4e~headers-thread-prefix-map 'orphan) "") (if duplicate (mu4e~headers-thread-prefix-map 'duplicate) ""))))) From 94e9795d9dc55bc4f8e68ac6c45150addc6a9b8e Mon Sep 17 00:00:00 2001 From: Marcelo Henrique Cerri Date: Thu, 3 May 2018 08:27:20 -0300 Subject: [PATCH 3/3] mu4e: Do not assume orphan messages can't appear in the middle of a thread Do not clear the thread state when an orphan message is found. --- mu4e/mu4e-headers.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index e2700f19..81158705 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -462,7 +462,7 @@ into a string." (last-child (plist-get thread :last-child)) (duplicate (plist-get thread :duplicate))) ;; Do not prefix root messages. - (if (or (= level 0) empty-parent) + (if (= level 0) (setq mu4e~headers-thread-state '())) (if (> level 0) (let* ((length (length mu4e~headers-thread-state))