mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-23 03:18:08 +01:00
emacs/show: display count of duplicates in headerline
There is no real cost here, except screen real estate. Some people might prefer hiding the duplicate count, but we leave that for a future commit.
This commit is contained in:
parent
b3d466bf39
commit
5ea5a5557d
5 changed files with 59 additions and 6 deletions
|
@ -530,7 +530,7 @@ Return unchanged ADDRESS if parsing fails."
|
|||
(plist-put msg :height height)
|
||||
height))))
|
||||
|
||||
(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))
|
||||
|
@ -550,7 +550,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)))
|
||||
|
||||
|
@ -1154,6 +1161,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
|
||||
|
@ -1165,7 +1174,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
|
||||
|
|
|
@ -341,7 +341,7 @@ test_expect_equal_file EXPECTED OUTPUT
|
|||
add_email_corpus duplicate
|
||||
|
||||
ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
|
||||
test_begin_subtest "duplicate=3"
|
||||
test_begin_subtest "duplicate=3, subject"
|
||||
test_emacs "(notmuch-show \"id:${ID3}\")
|
||||
(notmuch-show-choose-duplicate 3)
|
||||
(test-visible-output \"OUTPUT\")"
|
||||
|
@ -367,4 +367,10 @@ cat <<EOF > EXPECTED
|
|||
(error Duplicate 1000 out of range [1,5])
|
||||
EOF
|
||||
test_expect_equal_file EXPECTED MESSAGES
|
||||
test_begin_subtest "duplicate=4"
|
||||
test_emacs "(notmuch-show \"id:${ID3}\")
|
||||
(notmuch-show-choose-duplicate 4)
|
||||
(test-visible-output \"OUTPUT\")"
|
||||
test_expect_equal_file_nonempty $EXPECTED/notmuch-show-duplicate-4 OUTPUT
|
||||
|
||||
test_done
|
||||
|
|
|
@ -203,7 +203,7 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE"
|
|||
add_email_corpus duplicate
|
||||
|
||||
ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
|
||||
test_begin_subtest "duplicate=3"
|
||||
test_begin_subtest "duplicate=3, subject"
|
||||
test_emacs "(notmuch-tree \"id:${ID3}\")
|
||||
(notmuch-test-wait)
|
||||
(notmuch-tree-show-message t)
|
||||
|
@ -214,4 +214,12 @@ file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1)
|
|||
subject=$(grep '^Subject:' $file)
|
||||
test_expect_equal "$output" "$subject"
|
||||
|
||||
test_begin_subtest "duplicate=4"
|
||||
test_emacs "(notmuch-show \"id:${ID3}\")
|
||||
(notmuch-test-wait)
|
||||
(notmuch-tree-show-message t)
|
||||
(notmuch-show-choose-duplicate 4)
|
||||
(test-visible-output \"OUTPUT\")"
|
||||
test_expect_equal_file_nonempty $NOTMUCH_SRCDIR/test/emacs-show.expected-output/notmuch-show-duplicate-4 OUTPUT
|
||||
|
||||
test_done
|
||||
|
|
|
@ -60,7 +60,7 @@ test_expect_equal "$(cat MESSAGES)" "COMPLETE"
|
|||
add_email_corpus duplicate
|
||||
|
||||
ID3=87r2ecrr6x.fsf@zephyr.silentflame.com
|
||||
test_begin_subtest "duplicate=3"
|
||||
test_begin_subtest "duplicate=3, subject"
|
||||
test_emacs "(let ((notmuch-tree-show-out t))
|
||||
(notmuch-unthreaded \"id:${ID3}\")
|
||||
(notmuch-test-wait)
|
||||
|
@ -72,4 +72,14 @@ file=$(notmuch search --output=files id:${ID3} | head -n 3 | tail -n 1)
|
|||
subject=$(grep '^Subject:' $file)
|
||||
test_expect_equal "$output" "$subject"
|
||||
|
||||
test_begin_subtest "duplicate=4"
|
||||
test_emacs "(let ((notmuch-tree-show-out t))
|
||||
(notmuch-unthreaded \"id:${ID3}\")
|
||||
(notmuch-test-wait)
|
||||
(notmuch-tree-show-message nil)
|
||||
(notmuch-show-choose-duplicate 4)
|
||||
(test-visible-output \"OUTPUT\"))"
|
||||
test_expect_equal_file_nonempty $NOTMUCH_SRCDIR/test/emacs-show.expected-output/notmuch-show-duplicate-4 OUTPUT
|
||||
|
||||
|
||||
test_done
|
||||
|
|
20
test/emacs-show.expected-output/notmuch-show-duplicate-4
Normal file
20
test/emacs-show.expected-output/notmuch-show-duplicate-4
Normal file
|
@ -0,0 +1,20 @@
|
|||
Sean Whitton <spwhitton@spwhitton.name> (2018-12-20) (inbox signed) 4/5
|
||||
Subject: [Pkg-emacsen-addons] Bug#916811: Increase severity to 'serious'
|
||||
To: 916805@bugs.debian.org, 916807@bugs.debian.org, 916808@bugs.debian.org, 916809@bugs.debian.org, 916811@bugs.debian.org, 916867@bugs.debian.org, 916869@bugs.debian.org, 916872@bugs.debian.org, 916875@bugs.debian.org, 916876@bugs.debian.org
|
||||
Date: Thu, 20 Dec 2018 18:25:26 +0000
|
||||
|
||||
[ multipart/mixed ]
|
||||
[ multipart/signed ]
|
||||
[ Unknown key ID 0x695B7AE4BF066240 or unsupported algorithm ]
|
||||
[ text/plain ]
|
||||
control: severity -1 serious
|
||||
|
||||
Hello,
|
||||
|
||||
Emacs 26.1 has reached Debian unstable (sooner than expected; sorry for
|
||||
all the e-mails).
|
||||
|
||||
[ 2-line signature. Click/Enter to show. ]
|
||||
[ signature.asc: application/pgp-signature ]
|
||||
[ text/plain ]
|
||||
[ 4-line signature. Click/Enter to show. ]
|
Loading…
Reference in a new issue