mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Display images from gpg signatures
* epg.el (epg-signature-to-string): Use new functions epg-key-image, epg-key-image-to-string to find and display image from key.
This commit is contained in:
parent
ecfb998c17
commit
23dab7dca6
2 changed files with 32 additions and 2 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2012-12-25 Adam Sjøgren <asjo@koldfront.dk>
|
||||
|
||||
* epg.el (epg-signature-to-string): Use new functions
|
||||
epg-key-image, epg-key-image-to-string to find and display image
|
||||
from key.
|
||||
|
||||
2012-12-24 Constantin Kulikov <zxnotdead@gmail.com> (tiny change)
|
||||
|
||||
* startup.el (initial-buffer-choice): Allow function as value
|
||||
|
|
|
|||
28
lisp/epg.el
28
lisp/epg.el
|
|
@ -967,11 +967,34 @@ This function is for internal use only."
|
|||
(setcdr entry value)
|
||||
(epg-context-set-result context (cons (cons name value) result)))))
|
||||
|
||||
(defun epg-key-image (key-id)
|
||||
"Return the image of a key, if any"
|
||||
(let ((filename
|
||||
(replace-regexp-in-string
|
||||
"\n" ""
|
||||
(shell-command-to-string
|
||||
(concat "/usr/bin/gpg --photo-viewer 'echo %I >&2' --list-keys "
|
||||
key-id " > /dev/null")))))
|
||||
(when (and (not (string-equal filename ""))
|
||||
(file-exists-p filename))
|
||||
(create-image filename))))
|
||||
|
||||
(defun epg-key-image-to-string (key-id)
|
||||
"Return a string with the image of a key, if any"
|
||||
(let* ((result "")
|
||||
(key-image (epg-key-image key-id)))
|
||||
(when key-image
|
||||
(setq result " ")
|
||||
(put-text-property 1 2 'display key-image result))
|
||||
result))
|
||||
|
||||
(defun epg-signature-to-string (signature)
|
||||
"Convert SIGNATURE to a human readable string."
|
||||
(let* ((user-id (cdr (assoc (epg-signature-key-id signature)
|
||||
epg-user-id-alist)))
|
||||
(pubkey-algorithm (epg-signature-pubkey-algorithm signature)))
|
||||
(pubkey-algorithm (epg-signature-pubkey-algorithm signature))
|
||||
(key-id (epg-signature-key-id signature))
|
||||
(key-image (epg-key-image-to-string key-id)))
|
||||
(concat
|
||||
(cond ((eq (epg-signature-status signature) 'good)
|
||||
"Good signature from ")
|
||||
|
|
@ -985,7 +1008,8 @@ This function is for internal use only."
|
|||
"Signature made by revoked key ")
|
||||
((eq (epg-signature-status signature) 'no-pubkey)
|
||||
"No public key for "))
|
||||
(epg-signature-key-id signature)
|
||||
key-id
|
||||
key-image
|
||||
(if user-id
|
||||
(concat " "
|
||||
(if (stringp user-id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue