summary refs log tree commit diff stats
path: root/emacs/.emacs.d
diff options
context:
space:
mode:
authorAlan Pearce2017-04-07 16:41:24 +0200
committerAlan Pearce2017-04-07 16:41:24 +0200
commitda106a2392ebebb3cefb425d3f3ba9285a5e647d (patch)
treefc462c49666fa22340047bbc695efab845c3e45e /emacs/.emacs.d
parentcb87415ddb236b9871c6919301aecf3c85977271 (diff)
downloaddotfiles-da106a2392ebebb3cefb425d3f3ba9285a5e647d.tar.lz
dotfiles-da106a2392ebebb3cefb425d3f3ba9285a5e647d.tar.zst
dotfiles-da106a2392ebebb3cefb425d3f3ba9285a5e647d.zip
Emacs: Make encrypted configuration system-specific
Diffstat (limited to 'emacs/.emacs.d')
-rw-r--r--emacs/.emacs.d/ap-spotcap.local.el.gpg (renamed from emacs/.emacs.d/private.el.gpg)bin2438 -> 2438 bytes
-rw-r--r--emacs/.emacs.d/init.org26
2 files changed, 14 insertions, 12 deletions
diff --git a/emacs/.emacs.d/private.el.gpg b/emacs/.emacs.d/ap-spotcap.local.el.gpg
index 37ce02a..37ce02a 100644
--- a/emacs/.emacs.d/private.el.gpg
+++ b/emacs/.emacs.d/ap-spotcap.local.el.gpg
Binary files differdiff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 0b65c44..6290bb4 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -1248,18 +1248,20 @@ rather useful.
 ; startup and caches it. Don't want emacs daemon to hang because of gpg-agent.
 (defun load-private-data ()
   (interactive)
-  (if (not have-private-key)
-      (message "ERROR: Private GPG key not found")
-    (unless (or (getenv "GPG_AGENT_INFO")
-                (getenv "SSH_AUTH_SOCK"))
-      (start-process "gpg-agent" nil "gpg-agent" "--daemon")
-      (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock))
-    (setq password-cache-expiry nil)
-    (unless (file-exists-p (concat pinentry--socket-dir "pinentry"))
-      (pinentry-start)
-      (add-hook 'kill-emacs-hook 'pinentry-stop))
-    (add-to-list 'load-suffixes ".el.gpg")
-    (load-gpg (expand-file-name "private" user-emacs-directory))))
+  (if (not (file-exists-p (expand-file-name (concat system-name ".el.gpg") user-emacs-directory)))
+      (message "No encrypted configuration matches system name `%s'" system-name)
+    (if (not have-private-key)
+        (message "ERROR: Private GPG key not found")
+      (unless (or (getenv "GPG_AGENT_INFO")
+                  (getenv "SSH_AUTH_SOCK"))
+        (start-process "gpg-agent" nil "gpg-agent" "--daemon")
+        (setenv "SSH_AUTH_SOCK" gpg-agent-ssh-sock))
+      (setq password-cache-expiry nil)
+      (unless (file-exists-p (concat pinentry--socket-dir "pinentry"))
+        (pinentry-start)
+        (add-hook 'kill-emacs-hook 'pinentry-stop))
+      (add-to-list 'load-suffixes ".el.gpg")
+      (load-gpg (expand-file-name system-name user-emacs-directory)))))
 
 (defun first-frame-hook (frame)
   (remove-hook 'after-make-frame-functions #'first-frame-hook)