With duplicate files, the headerlines of messages in notmuch-show
buffer contains (initially) 1/n at the end of line.

Update the regexp used to search and replace tag changes to
match the current line -- drop unnecessary capturing of the
(tags), but capture the duplicates indicator.

Update the headerline pretty much like notmuch-show-insert-headerline
does, like the changes introduced mostly in commit 5ea5a5557d9a.
---

Is this getting too complex (well, we may have other stuff with
similar complexity there ;/) ?

Is there any better solutions ?

 emacs/notmuch-show.el | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ec998ede..0527c3a5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -453,13 +453,20 @@ (defun notmuch-show-update-tags (tags)
   "Update the displayed tags of the current message."
   (save-excursion
     (goto-char (notmuch-show-message-top))
-    (when (re-search-forward "(\\([^()]*\\))$" (line-end-position) t)
-      (let ((inhibit-read-only t))
-       (replace-match (concat "("
-                              (notmuch-tag-format-tags
-                               tags
-                               (notmuch-show-get-prop :orig-tags))
-                              ")"))))))
+    (when (re-search-forward "([^()]*) *\\([^()]*\\)$" (line-end-position) t)
+      (let ((inhibit-read-only t)
+           (tags-str (notmuch-tag-format-tags
+                      tags (notmuch-show-get-prop :orig-tags)))
+           (txt (match-string 1)))
+       (replace-match (concat "(" tags-str ")"
+                              (and (string-lessp "" txt)
+                                   (notmuch-show-spaces-n
+                                    (max 0 (- (window-width)
+                                              (- (match-beginning 0)
+                                                 (notmuch-show-message-top))
+                                              (length tags-str)
+                                              (length txt) 3))))
+                              txt))))))
 
 (defun notmuch-clean-address (address)
   "Try to clean a single email ADDRESS for display. Return a cons
-- 
2.30.2

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to