[PATCH v2] emacs: reply: remove wrong sig/enc status buttons

Mark Walters markwalters1009 at gmail.com
Mon Sep 12 15:12:19 PDT 2016


This stopps the (usually incorrect) sigstatus and encstatus buttons
appearing when replying in emacs, and updates the test suite to match.

Overriding the status button functions is a little unusual but much
less intrusive than passing an argument all the way down the call
chain. It also makes it clear exactly what it does.

We also hide the application/pgp-encrypted part as it can only contain
"Version: 1". We do this in notmuch show, which means it also happens
when replying.

---

This fixes the bug David mentioned of Version: 1 appearing in the
reply. We actually fix it by making notmuch-show.el not display this
either.

The patch is as before but with the addition of the 3 lines for
notmuch-show.

Best wishes

Mark



emacs/notmuch-mua.el  | 7 +++++--
 emacs/notmuch-show.el | 3 +++
 test/T310-emacs.sh    | 2 --
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index fadf20f..55bc267 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -253,8 +253,11 @@ mutiple parts get a header."
 		       (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function)
 		       ;; Don't indent multipart sub-parts.
 		       (notmuch-show-indent-multipart nil))
-		    (notmuch-show-insert-body original (plist-get original :body) 0)
-		    (buffer-substring-no-properties (point-min) (point-max)))))
+		    ;; We don't want sigstatus buttons (an information leak and usually wrong anyway).
+		    (letf (((symbol-function 'notmuch-crypto-insert-sigstatus-button) #'ignore)
+			   ((symbol-function 'notmuch-crypto-insert-encstatus-button) #'ignore))
+			  (notmuch-show-insert-body original (plist-get original :body) 0)
+			  (buffer-substring-no-properties (point-min) (point-max))))))
 
 	(set-mark (point))
 	(goto-char start)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index eb6877e..0c7d8a1 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -682,6 +682,9 @@ will return nil if the CID is unknown or cannot be retrieved."
       (indent-rigidly start (point) 1)))
   t)
 
+(defun notmuch-show-insert-part-application/pgp-encrypted (msg part content-type nth depth button)
+  t)
+
 (defun notmuch-show-insert-part-multipart/* (msg part content-type nth depth button)
   (let ((inner-parts (plist-get part :content))
 	(start (point)))
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 202fc3b..21675b6 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -384,8 +384,6 @@ References: <20091118002059.067214ed at hikari>
 --text follows this line--
 Adrian Perez de Castro <aperez at igalia.com> writes:
 
-> [ Unknown signature status ]
->
 > Hello to all,
 >
 > I have just heard about Not Much today in some random Linux-related news
-- 
2.1.4



More information about the notmuch mailing list