From: David Edmondson <dme@dme.org>
To: notmuch@notmuchmail.org
Subject: using the fringe to indicate good signatures
Date: Thu, 20 Aug 2015 14:12:26 +0100 [thread overview]
Message-ID: <m2mvxmxfwl.fsf@heart-of-gold.hh.sledj.net> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 353 bytes --]
After listening to bremner, dkg et al. from Heidelberg, I threw together
a quick patch to see how we might indicate signature validity in the
fringe. The intention is to prompt more discussion - this code is not
ready to ship.
The patch is attached. The result looks something like:
http://dme.org/data/images/notmuch-signed-fringe.png
Thoughts?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: signed-fringe.diff --]
[-- Type: text/x-patch, Size: 2863 bytes --]
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4dee34b..3d447af 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -646,25 +646,46 @@ will return nil if the CID is unknown or cannot be retrieved."
(indent-rigidly start (point) 1)))
t)
-(defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth 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 sigstatus, tell the user how they can get it
- (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
+;; None of the existing fringe bitmaps are empty.
+(define-fringe-bitmap 'notmuch-show--fringe-empty '[])
- (let ((inner-parts (plist-get part :content))
- (start (point)))
- ;; Show all of the parts.
- (mapc (lambda (inner-part)
- (notmuch-show-insert-bodypart msg inner-part depth))
- inner-parts)
+(defun notmuch-show--sigstatus-to-fringe-string (status)
+ (let ((good-bad-ugly (plist-get status :status)))
+ (cond
+ ((string= good-bad-ugly "good")
+ (propertize "dummy" 'display
+ '(left-fringe notmuch-show--fringe-empty notmuch-crypto-signature-good)))
+ ;; XXX dme: insert more here.
+ (t nil))))
- (when notmuch-show-indent-multipart
- (indent-rigidly start (point) 1)))
+(defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth button)
+ (let ((start-of-signed (point)))
+ (button-put button 'face 'notmuch-crypto-part-header)
+
+ (let ((sigstatus (car (plist-get part :sigstatus)))
+ (from (notmuch-show-get-header :From msg)))
+ ;; Add signature status button if status is provided.
+ (if sigstatus
+ (notmuch-crypto-insert-sigstatus-button sigstatus from)
+ ;; If we're not adding the status, tell the user how they can
+ ;; get it.
+ (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic MIME parts."))
+
+ (let ((inner-parts (plist-get part :content))
+ (start (point))
+ (fringe-string (notmuch-show--sigstatus-to-fringe-string sigstatus)))
+ ;; Show all of the parts.
+ (mapc (lambda (inner-part)
+ (notmuch-show-insert-bodypart msg inner-part depth))
+ inner-parts)
+
+ (when notmuch-show-indent-multipart
+ (indent-rigidly start (point) 1))
+
+ (when fringe-string
+ (replace-regexp "^" fringe-string nil start-of-signed (point))))
+ )
+ )
t)
(defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth button)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 292 bytes --]
next reply other threads:[~2015-08-20 13:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-20 13:12 David Edmondson [this message]
2015-09-07 22:50 ` using the fringe to indicate good signatures Daniel Kahn Gillmor
2015-09-08 6:01 ` David Edmondson
2015-09-08 6:43 ` Daniel Kahn Gillmor
2015-09-08 9:53 ` David Edmondson
2015-09-08 18:00 ` Tomi Ollila
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=m2mvxmxfwl.fsf@heart-of-gold.hh.sledj.net \
--to=dme@dme.org \
--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).