[Utils] Move S/MIME lookup function to init.el
This commit is contained in:
parent
ace325c1f9
commit
2a4302c883
22
gnus.el
22
gnus.el
|
@ -417,28 +417,6 @@ METHOD specifies the encrypt method used. Can be either
|
|||
(add-hook 'gnus-message-setup-hook
|
||||
#'db/signencrypt-message-when-possible)
|
||||
|
||||
;; inspired by https://www.emacswiki.org/emacs/ExtendSMIME
|
||||
|
||||
(defun db/lookup-smime-key (mail)
|
||||
"Look up `MAIL' on ldap-server of the DFN.
|
||||
|
||||
If found, imports the certificate via gpgsm."
|
||||
(interactive "sMail: ")
|
||||
(when (get-buffer " *ldap-value*")
|
||||
(kill-buffer " *ldap-value*"))
|
||||
(ldap-search (format "(mail=%s)" mail))
|
||||
(let ((bufval (get-buffer " *ldap-value*")))
|
||||
(when bufval
|
||||
(with-current-buffer bufval
|
||||
(save-restriction
|
||||
(widen) ; just to be sure
|
||||
(let ((result (call-process-region (point-min) (point-max)
|
||||
"gpgsm"
|
||||
nil nil nil
|
||||
"--import")))
|
||||
(if (zerop result)
|
||||
(message "Successfully imported certificate for <%s>" mail)
|
||||
(error "Could not import certificate for <%s>" mail))))))))
|
||||
|
||||
;; Fix
|
||||
|
||||
|
|
3
init.el
3
init.el
|
@ -539,7 +539,8 @@
|
|||
db/one-monitor-xrandr
|
||||
db/pretty-print-xml
|
||||
db/bookmark-add-external
|
||||
db/bookmark-add-url))
|
||||
db/bookmark-add-url
|
||||
db/lookup-smime-key))
|
||||
|
||||
(use-package hydra
|
||||
:commands (defhydra))
|
||||
|
|
|
@ -268,6 +268,29 @@ are assumed to be of the form *.crt."
|
|||
;; Indent
|
||||
(indent-region (point-min) (point-max))))
|
||||
|
||||
(defun db/lookup-smime-key (mail)
|
||||
"Look up `MAIL' on ldap-server of the DFN.
|
||||
|
||||
If found, imports the certificate via gpgsm."
|
||||
;; inspired by https://www.emacswiki.org/emacs/ExtendSMIME
|
||||
(interactive "sMail: ")
|
||||
(require 'ldap)
|
||||
(when (get-buffer " *ldap-value*")
|
||||
(kill-buffer " *ldap-value*"))
|
||||
(ldap-search (format "(mail=%s)" mail))
|
||||
(let ((bufval (get-buffer " *ldap-value*")))
|
||||
(when bufval
|
||||
(with-current-buffer bufval
|
||||
(save-restriction
|
||||
(widen) ; just to be sure
|
||||
(let ((result (call-process-region (point-min) (point-max)
|
||||
"gpgsm"
|
||||
nil nil nil
|
||||
"--import")))
|
||||
(if (zerop result)
|
||||
(message "Successfully imported certificate for <%s>" mail)
|
||||
(error "Could not import certificate for <%s>" mail))))))))
|
||||
|
||||
|
||||
;;; helm configuration
|
||||
|
||||
|
|
Loading…
Reference in New Issue