From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [RFC PATCH v2 7/7] WIP/emacs: display count of duplicates in headerline
Date: Sun, 19 Jun 2022 20:21:53 -0300 [thread overview]
Message-ID: <20220619232152.846823-8-david@tethera.net> (raw)
In-Reply-To: <20220619232152.846823-1-david@tethera.net>
---
emacs/notmuch-show.el | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1777756b..32d0edc5 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -493,7 +493,7 @@ Return unchanged ADDRESS if parsing fails."
;; Otherwise format the name and address together.
(concat p-name " <" p-address ">"))))
-(defun notmuch-show-insert-headerline (headers date tags depth)
+(defun notmuch-show-insert-headerline (headers date tags depth duplicate file-count)
"Insert a notmuch style headerline based on HEADERS for a
message at DEPTH in the current thread."
(let ((start (point))
@@ -513,7 +513,14 @@ message at DEPTH in the current thread."
date
") ("
(notmuch-tag-format-tags tags tags)
- ")\n")
+ ")")
+ (insert
+ (if (> file-count 1)
+ (let ((txt (format "%d/%d\n" duplicate file-count)))
+ (concat
+ (notmuch-show-spaces-n (- (window-width) (+ (current-column) (length txt))))
+ txt))
+ "\n"))
(overlay-put (make-overlay start (point))
'face 'notmuch-message-summary-face)))
@@ -1104,6 +1111,8 @@ is t, hide the part initially and show the button."
(defun notmuch-show-insert-msg (msg depth)
"Insert the message MSG at depth DEPTH in the current thread."
(let* ((headers (plist-get msg :headers))
+ (duplicate (or (plist-get msg :duplicate) 0))
+ (files (length (plist-get msg :filename)))
;; Indentation causes the buffer offset of the start/end
;; points to move, so we must use markers.
message-start message-end
@@ -1115,7 +1124,7 @@ is t, hide the part initially and show the button."
(or (and notmuch-show-relative-dates
(plist-get msg :date_relative))
(plist-get headers :Date))
- (plist-get msg :tags) depth)
+ (plist-get msg :tags) depth duplicate files)
(setq content-start (point-marker))
;; Set `headers-start' to point after the 'Subject:' header to be
;; compatible with the existing implementation. This just sets it
--
2.35.2
next prev parent reply other threads:[~2022-06-19 23:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-19 23:21 v2 WIP commands to choose duplicates in emacs interface David Bremner
2022-06-19 23:21 ` [RFC PATCH v2 1/7] test: use notmuch_json_show_sanitize more places David Bremner
2022-06-19 23:21 ` [RFC PATCH v2 2/7] test: define and use notmuch_sexp_*_sanitize functions David Bremner
2022-06-19 23:21 ` [RFC PATCH v2 3/7] test: add new corpus of duplicate messages David Bremner
2022-06-19 23:21 ` [RFC PATCH v2 4/7] CLI/show: WIP support --duplicate for raw output David Bremner
2022-06-19 23:21 ` [RFC PATCH v2 5/7] WIP: support show --duplicate for structured output David Bremner
2022-06-19 23:21 ` [RFC PATCH v2 6/7] WIP/emacs: replace message with different duplicate David Bremner
2022-06-19 23:21 ` David Bremner [this message]
2022-06-29 12:15 ` v2 WIP commands to choose duplicates in emacs interface David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220619232152.846823-8-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).