aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/epg.el28
2 files changed, 32 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2181a6dde7e..73379a93027 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-12-25 Adam Sjøgren <asjo@koldfront.dk>
2
3 * epg.el (epg-signature-to-string): Use new functions
4 epg-key-image, epg-key-image-to-string to find and display image
5 from key.
6
12012-12-24 Constantin Kulikov <zxnotdead@gmail.com> (tiny change) 72012-12-24 Constantin Kulikov <zxnotdead@gmail.com> (tiny change)
2 8
3 * startup.el (initial-buffer-choice): Allow function as value 9 * startup.el (initial-buffer-choice): Allow function as value
diff --git a/lisp/epg.el b/lisp/epg.el
index 833a68d6e7e..b79c5df4165 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -967,11 +967,34 @@ This function is for internal use only."
967 (setcdr entry value) 967 (setcdr entry value)
968 (epg-context-set-result context (cons (cons name value) result))))) 968 (epg-context-set-result context (cons (cons name value) result)))))
969 969
970(defun epg-key-image (key-id)
971 "Return the image of a key, if any"
972 (let ((filename
973 (replace-regexp-in-string
974 "\n" ""
975 (shell-command-to-string
976 (concat "/usr/bin/gpg --photo-viewer 'echo %I >&2' --list-keys "
977 key-id " > /dev/null")))))
978 (when (and (not (string-equal filename ""))
979 (file-exists-p filename))
980 (create-image filename))))
981
982(defun epg-key-image-to-string (key-id)
983 "Return a string with the image of a key, if any"
984 (let* ((result "")
985 (key-image (epg-key-image key-id)))
986 (when key-image
987 (setq result " ")
988 (put-text-property 1 2 'display key-image result))
989 result))
990
970(defun epg-signature-to-string (signature) 991(defun epg-signature-to-string (signature)
971 "Convert SIGNATURE to a human readable string." 992 "Convert SIGNATURE to a human readable string."
972 (let* ((user-id (cdr (assoc (epg-signature-key-id signature) 993 (let* ((user-id (cdr (assoc (epg-signature-key-id signature)
973 epg-user-id-alist))) 994 epg-user-id-alist)))
974 (pubkey-algorithm (epg-signature-pubkey-algorithm signature))) 995 (pubkey-algorithm (epg-signature-pubkey-algorithm signature))
996 (key-id (epg-signature-key-id signature))
997 (key-image (epg-key-image-to-string key-id)))
975 (concat 998 (concat
976 (cond ((eq (epg-signature-status signature) 'good) 999 (cond ((eq (epg-signature-status signature) 'good)
977 "Good signature from ") 1000 "Good signature from ")
@@ -985,7 +1008,8 @@ This function is for internal use only."
985 "Signature made by revoked key ") 1008 "Signature made by revoked key ")
986 ((eq (epg-signature-status signature) 'no-pubkey) 1009 ((eq (epg-signature-status signature) 'no-pubkey)
987 "No public key for ")) 1010 "No public key for "))
988 (epg-signature-key-id signature) 1011 key-id
1012 key-image
989 (if user-id 1013 (if user-id
990 (concat " " 1014 (concat " "
991 (if (stringp user-id) 1015 (if (stringp user-id)