feat: add gpg-encrypt-sign-save-buffer
function
Signed-off-by: Lucas Sta Maria <lucas@priime.dev>
This commit is contained in:
parent
68593c4e6b
commit
c3cd4201fc
1 changed files with 21 additions and 0 deletions
|
@ -49,5 +49,26 @@
|
||||||
(setq info (-filter (lambda (s) (not (string-match "image" (car s)))) info))
|
(setq info (-filter (lambda (s) (not (string-match "image" (car s)))) info))
|
||||||
info)))
|
info)))
|
||||||
|
|
||||||
|
(defun gpg-encrypt-sign-save-buffer (&optional filename)
|
||||||
|
"Encrypt, sign, and save the buffer as FILENAME.asc for the recipients."
|
||||||
|
(interactive)
|
||||||
|
|
||||||
|
(let* ((key-alist (gpg-public-keys))
|
||||||
|
(recipients (completing-read-multiple "Recipients: " key-alist))
|
||||||
|
(recipient-keys (mapcar (lambda (x) (cdr (assoc x key-alist)))
|
||||||
|
recipients))
|
||||||
|
(recipients-cli-args (mapconcat (lambda (s) (concat "-r " s))
|
||||||
|
recipient-keys
|
||||||
|
" ")))
|
||||||
|
(unless (or filename buffer-file-name)
|
||||||
|
(setq filename (read-string "Filename: " nil nil)))
|
||||||
|
(let ((gpg-encrypt-command
|
||||||
|
(concat "gpg --encrypt --sign --armor "
|
||||||
|
recipients-cli-args
|
||||||
|
" "
|
||||||
|
(or filename buffer-file-name))))
|
||||||
|
(redraw-display)
|
||||||
|
(term gpg-encrypt-command))))
|
||||||
|
|
||||||
(provide 'gpgconfig)
|
(provide 'gpgconfig)
|
||||||
;;; gpgconfig.el ends here
|
;;; gpgconfig.el ends here
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue