From f8effea9a3da8701b4edb0c64dbcb333d3ce4320 Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Sun, 3 Apr 2016 16:38:22 +0100 Subject: [PATCH] emacs: Always insert crypto buttons. When no decryption or signature examination is happening (i.e. `notmuch-crypto-process-mime' is `nil') insert buttons that indicate this, rather than remaining silent. --- emacs/notmuch-show.el | 34 ++++++------------- test/T310-emacs.sh | 2 ++ ...tmuch-show-elide-non-matching-messages-off | 3 ++ ...otmuch-show-elide-non-matching-messages-on | 3 ++ .../notmuch-show-indent-thread-content-off | 3 ++ ...notmuch-show-process-crypto-mime-parts-off | 1 + .../notmuch-show-thread-maildir-storage | 4 +++ ...-maildir-storage-with-fourfold-indentation | 4 +++ ...thread-maildir-storage-without-indentation | 4 +++ .../notmuch-tree-show-window | 1 + 10 files changed, 36 insertions(+), 23 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index f6a21e47..46e3869d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -642,15 +642,10 @@ will return nil if the CID is unknown or cannot be retrieved." (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button) (when button (button-put button 'face 'notmuch-crypto-part-header)) - ;; Add signature status button if sigstatus provided. - (if (plist-member part :sigstatus) - (let* ((from (notmuch-show-get-header :From msg)) - (sigstatus (car (plist-get part :sigstatus)))) - (notmuch-crypto-insert-sigstatus-button sigstatus from)) - ;; If we're not adding the signature status, tell the user how - ;; they can get it. - (when button - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))) + + ;; Insert a button detailing the signature status. + (notmuch-crypto-insert-sigstatus-button (car (plist-get part :sigstatus)) + (notmuch-show-get-header :From msg)) (let ((inner-parts (plist-get part :content)) (start (point))) @@ -666,20 +661,13 @@ will return nil if the CID is unknown or cannot be retrieved." (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button) (when button (button-put button 'face 'notmuch-crypto-part-header)) - ;; Add encryption status button if encryption status is specified. - (if (plist-member part :encstatus) - (let ((encstatus (car (plist-get part :encstatus)))) - (notmuch-crypto-insert-encstatus-button encstatus) - ;; Add signature status button if signature status is - ;; specified. - (if (plist-member part :sigstatus) - (let* ((from (notmuch-show-get-header :From msg)) - (sigstatus (car (plist-get part :sigstatus)))) - (notmuch-crypto-insert-sigstatus-button sigstatus from)))) - ;; If we're not adding the encryption status, tell the user how - ;; they can get it. - (when button - (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))) + + ;; Insert a button detailing the encryption status. + (notmuch-crypto-insert-encstatus-button (car (plist-get part :encstatus))) + + ;; Insert a button detailing the signature status. + (notmuch-crypto-insert-sigstatus-button (car (plist-get part :sigstatus)) + (notmuch-show-get-header :From msg)) (let ((inner-parts (plist-get part :content)) (start (point))) diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 43b99736..daa02568 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -394,6 +394,8 @@ User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Adrian Perez de Castro writes: +> [ Unknown signature status ] +> > Hello to all, > > I have just heard about Not Much today in some random Linux-related news diff --git a/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off index b31fe622..9f1e91f0 100644 --- a/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off +++ b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-off @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of @@ -39,6 +40,7 @@ Cheers, [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > See the patch just posted here. @@ -65,6 +67,7 @@ Cheers, [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > I've also pushed a slightly more complicated (and complete) fix to my > private notmuch repository diff --git a/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on index bafb479e..118053ba 100644 --- a/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on +++ b/test/emacs-show.expected-output/notmuch-show-elide-non-matching-messages-on @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of @@ -38,6 +39,7 @@ Cheers, [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > See the patch just posted here. @@ -62,6 +64,7 @@ Cheers, [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > I've also pushed a slightly more complicated (and complete) fix to my > private notmuch repository diff --git a/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off b/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off index 37b4f7de..2cb12118 100644 --- a/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off +++ b/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of @@ -39,6 +40,7 @@ Date: Tue, 17 Nov 2009 15:33:01 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] > See the patch just posted here. @@ -65,6 +67,7 @@ Date: Tue, 17 Nov 2009 19:50:40 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] > I've also pushed a slightly more complicated (and complete) fix to my > private notmuch repository diff --git a/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off index 3282c7b1..ce2892a0 100644 --- a/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off +++ b/test/emacs-show.expected-output/notmuch-show-process-crypto-mime-parts-off @@ -9,6 +9,7 @@ Subject: [notmuch] Working with Maildir storage? [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > See the patch just posted here. diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage b/test/emacs.expected-output/notmuch-show-thread-maildir-storage index cdbfa1d7..35998922 100644 --- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage +++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of @@ -45,6 +46,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did @@ -77,6 +79,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > See the patch just posted here. @@ -159,6 +162,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > I've also pushed a slightly more complicated (and complete) fix to my > private notmuch repository diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation index b0bf93ed..4721b8b0 100644 --- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation +++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of @@ -45,6 +46,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did @@ -77,6 +79,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > See the patch just posted here. @@ -159,6 +162,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch [ multipart/mixed ] [ multipart/signed ] + [ Unknown signature status ] [ text/plain ] > I've also pushed a slightly more complicated (and complete) fix to my > private notmuch repository diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation index 08de8b5d..62a46353 100644 --- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation +++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of @@ -45,6 +46,7 @@ Date: Wed, 18 Nov 2009 01:02:38 +0600 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did @@ -77,6 +79,7 @@ Date: Tue, 17 Nov 2009 15:33:01 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] > See the patch just posted here. @@ -159,6 +162,7 @@ Date: Tue, 17 Nov 2009 19:50:40 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] > I've also pushed a slightly more complicated (and complete) fix to my > private notmuch repository diff --git a/test/tree.expected-output/notmuch-tree-show-window b/test/tree.expected-output/notmuch-tree-show-window index e16792b8..ab7205b7 100644 --- a/test/tree.expected-output/notmuch-tree-show-window +++ b/test/tree.expected-output/notmuch-tree-show-window @@ -5,6 +5,7 @@ Date: Tue, 17 Nov 2009 14:00:54 -0500 [ multipart/mixed ] [ multipart/signed ] +[ Unknown signature status ] [ text/plain ] I saw the LWN article and decided to take a look at notmuch. I'm currently using mutt and mairix to index and read a collection of