aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch-crypto.el
diff options
context:
space:
mode:
authorGravatar Thomas Jost <schnouki@schnouki.net>2011-03-31 00:31:04 +0200
committerGravatar Carl Worth <cworth@cworth.org>2011-06-01 21:41:24 -0700
commit09793b61324514b9691af36e19e6f124d54559e4 (patch)
tree582ab59a44351cfcb138bc11fdb6920f00b47919 /emacs/notmuch-crypto.el
parente584c64c5b0788a3b9c1b22f37eb236bb6da7d0d (diff)
emacs: Define several faces for the crypto-status button
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net> jrollins modified this patch to conform to recent changes in the crypto processing since this patch was originally sent in.
Diffstat (limited to 'emacs/notmuch-crypto.el')
-rw-r--r--emacs/notmuch-crypto.el42
1 files changed, 32 insertions, 10 deletions
diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index cb02840d..f03266ff 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -36,36 +36,58 @@ search."
:group 'notmuch
:type 'boolean)
+(defface notmuch-crypto-signature-good
+ '((t (:background "green" :foreground "black")))
+ "Face used for good signatures."
+ :group 'notmuch)
+
+(defface notmuch-crypto-signature-good-key
+ '((t (:background "orange" :foreground "black")))
+ "Face used for good signatures."
+ :group 'notmuch)
+
+(defface notmuch-crypto-signature-bad
+ '((t (:background "red" :foreground "black")))
+ "Face used for bad signatures."
+ :group 'notmuch)
+
+(defface notmuch-crypto-signature-unknown
+ '((t (:background "red" :foreground "black")))
+ "Face used for signatures of unknown status."
+ :group 'notmuch)
+
+(defface notmuch-crypto-decryption
+ '((t (:background "purple" :foreground "black")))
+ "Face used for encryption/decryption status messages."
+ :group 'notmuch)
+
(define-button-type 'notmuch-crypto-status-button-type
'action '(lambda (button) (message (button-get button 'help-echo)))
'follow-link t
- 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."
- 'face '(:foreground "blue")
- 'mouse-face '(:foreground "blue"))
+ 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")
(defun notmuch-crypto-insert-sigstatus-button (sigstatus from)
(let* ((status (plist-get sigstatus :status))
(help-msg nil)
(label "Signature not processed")
- (face '(:background "red" :foreground "black")))
+ (face 'notmuch-crypto-signature-unknown))
(cond
((string= status "good")
; if userid present, userid has full or greater validity
(if (plist-member sigstatus :userid)
(let ((userid (plist-get sigstatus :userid)))
(setq label (concat "Good signature by: " userid))
- (setq face '(:background "green" :foreground "black")))
+ (setq face 'notmuch-crypto-signature-good))
(let ((fingerprint (concat "0x" (plist-get sigstatus :fingerprint))))
(setq label (concat "Good signature by key: " fingerprint))
- (setq face '(:background "orange" :foreground "black")))))
+ (setq face 'notmuch-crypto-signature-good-key))))
((string= status "error")
(let ((keyid (concat "0x" (plist-get sigstatus :keyid))))
- (setq label (concat "Unknown key ID " keyid " or unsupported algorithm"))
- (setq face '(:background "red" :foreground "black"))))
+ (setq label (concat "Unknown key ID " keyid " or unsupported algorithm"))))
((string= status "bad")
(let ((keyid (concat "0x" (plist-get sigstatus :keyid))))
(setq label (concat "Bad signature (claimed key ID " keyid ")"))
- (setq face '(:background "red" :foreground "black"))))
+ (setq face 'notmuch-crypto-signature-bad)))
(t
(setq label "Unknown signature status")
(if status (setq label (concat label " \"" status "\"")))))
@@ -83,7 +105,7 @@ search."
(let* ((status (plist-get encstatus :status))
(help-msg nil)
(label "Decryption not attempted")
- (face '(:background "purple" :foreground "black")))
+ (face 'notmuch-crypto-decryption))
(cond
((string= status "good")
(setq label "Decryption successful"))