summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-10-30 14:30:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-10-30 14:30:45 -0700
commit06c1b996d0f4809c9c1d03fe408f9f1be0eb3c64 (patch)
tree41c64ad97b3b550d341ea3187d1f186f6ad5f32a /bin
parentd1fbe5a3ea5412b224faf5a3b8093703db52fedc (diff)
downloaddotfiles-06c1b996d0f4809c9c1d03fe408f9f1be0eb3c64.tar.gz
add upenv and update-emacs-daemon-environment
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update-emacs-daemon-environment28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/update-emacs-daemon-environment b/bin/update-emacs-daemon-environment
new file mode 100755
index 00000000..57a59f1b
--- /dev/null
+++ b/bin/update-emacs-daemon-environment
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Update Emacs daemon environment vars for a new interactive session. This
+# allows us to have the Emacs daemon survive restarts of the graphical desktop
+# environment, and to update Emacs on a remote host when there is a new
+# forwarded SSH agent socket.
+#
+# Note that this will start the Emacs daemon if it not up already.
+
+which emacsclient >/dev/null || exit 0
+
+for var in DISPLAY \
+ SSH_ASKPASS \
+ SSH_AUTH_SOCK \
+ SSH_AGENT_PID \
+ SSH_CONNECTION \
+ WINDOWID \
+ XAUTHORITY; do
+ eval isset=\${$var+x}
+ if [ "$isset" = "x" ]; then
+ eval value=\$$var
+ emacsclient -eval '(setenv "'$var'" "'$value'")'
+ fi
+done
+
+# finally, also call a function which now updates the values in our Lisp image
+# from Emacs' values (unimplemented)
+# emacsclient -eval '(spw/update-lisp-image-environment)'