From d0d305b48f55a911333043d3edc26cf76468e26f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 1 May 2021 08:32:39 +0300 Subject: [PATCH] mu-headers: Tweak thread prefix Avoids some confusion. Fixes: #1994. Fixes: #1933. --- mu4e/mu4e-headers.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 712d0cc8..06950318 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -461,6 +461,7 @@ into a string." (if mu4e-use-fancy-chars (cdr cell) (car cell))))) (cl-case type ('child (funcall get-prefix mu4e-headers-thread-child-prefix)) + ('first-child (funcall get-prefix mu4e-headers-thread-first-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)) @@ -469,6 +470,7 @@ into a string." ('duplicate (funcall get-prefix mu4e-headers-thread-duplicate-prefix)) (t "?")))) + ;; headers in the buffer are prefixed by an invisible string with the docid ;; followed by an EOT ('end-of-transmission', \004, ^D) non-printable ascii ;; character. this string also has a text-property with the docid. the former @@ -533,12 +535,13 @@ with DOCID which must be present in the headers buffer." (defun mu4e~headers-thread-prefix (thread) "Calculate the thread prefix based on thread info THREAD." (when thread - (let ((prefix "") + (let* ((prefix "") (level (plist-get thread :level)) (has-child (plist-get thread :has-child)) - (empty-parent (plist-get thread :empty-parent)) (first-child (plist-get thread :first-child)) (last-child (plist-get thread :last-child)) + (orphan (plist-get thread :orphan)) + (single-orphan(and orphan first-child last-child)) (duplicate (plist-get thread :duplicate))) ;; Do not prefix root messages. (if (= level 0) @@ -566,9 +569,11 @@ with DOCID which must be present in the headers buffer." mu4e~headers-thread-state "") ;; Current entry. (mu4e~headers-thread-prefix-map - (if (and empty-parent first-child) - (if last-child 'single-orphan 'orphan) - (if last-child 'last-child 'child))))))) + (if single-orphan 'single-orphan + (if orphan 'orphan + (if last-child 'last-child + (if first-child 'first-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