diff options
author | Thierry Volpiatto <thievol@posteo.net> | 2020-08-17 14:08:25 +0200 |
---|---|---|
committer | Thierry Volpiatto <thievol@posteo.net> | 2020-08-17 14:08:25 +0200 |
commit | e9aa28983be50f6cdf33420ed990959e197c4384 (patch) | |
tree | 2cdd52da30901a7ab8776139d400792792f71221 | |
parent | 5c8ad6a370b0e157934f119b1aa9c3c2f44149ff (diff) |
Add a user var for epa actions
and build source from a new class to allow further customizations.
-rw-r--r-- | helm-misc.el | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/helm-misc.el b/helm-misc.el index 7f5b1087..009e3a12 100644 --- a/helm-misc.el +++ b/helm-misc.el @@ -344,6 +344,22 @@ Default action change TZ environment variable locally to emacs." (declare-function epg-export-keys-to-string "epg") (declare-function epg-context-armor "epg") +(defcustom helm-epa-actions '(("Show key" . epa--show-key) + ("encrypt file with key" . helm-epa-encrypt-file) + ("Copy keys to kill ring" . helm-epa-kill-keys-armor) + ;; TODO filter these actions according to context. + ("Sign mail with key" . helm-epa-mail-sign) + ("Encrypt mail with key" . helm-epa-mail-encrypt)) + "Actions for `helm-list-epg-keys'." + :type '(alist :key-type string :value-type symbol) + :group 'helm-misc) + +(defclass helm-epa (helm-source-sync) + ((init :initform (lambda () + (require 'epg) + (require 'epa))) + (candidates :initform 'helm-epg-get-key-list))) + (defun helm-epg-get-key-list () "Build candidate list for `helm-list-epg-keys'." (cl-loop with all-keys = (epg-list-keys (epg-make-context epa-protocol)) @@ -439,17 +455,8 @@ Default action change TZ environment variable locally to emacs." This is the helm interface for `epa-list-keys'." (interactive) (helm :sources - (helm-build-sync-source "Epg list keys" - :init (lambda () - (require 'epg) - (require 'epa)) - :candidates 'helm-epg-get-key-list - :action '(("Show key" . epa--show-key) - ("encrypt file with key" . helm-epa-encrypt-file) - ("Copy keys to kill ring" . helm-epa-kill-keys-armor) - ;; TODO filter these actions according to context. - ("Sign mail with key" . helm-epa-mail-sign) - ("Encrypt mail with key" . helm-epa-mail-encrypt))) + (helm-make-source "Epg list keys" 'helm-epa + :action 'helm-epa-actions) :buffer "*helm epg list keys*")) (provide 'helm-misc) |