Skip to content

Instantly share code, notes, and snippets.

@jupp0r
Created December 18, 2015 10:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jupp0r/08ca64b7c14c6093bba2 to your computer and use it in GitHub Desktop.
Save jupp0r/08ca64b7c14c6093bba2 to your computer and use it in GitHub Desktop.
Using gpg-agent with emacs under OS X
;; read gpg-agent environment
(defun read-env-line (line)
"read a env line and post to environment"
(let ((key-value-pair (split-string line "=" t)))
(setenv (car key-value-pair) (car (last key-value-pair))))
)
(defvar gpg-agent-info-file)
(setq gpg-agent-info-file (concat (getenv "HOME") "/.gpg-agent-info"))
(when
(file-exists-p gpg-agent-info-file)
(with-temp-buffer
(progn
(insert-file-contents gpg-agent-info-file)
(mapc 'read-env-line (split-string (buffer-string) "\n" t)))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment