Emacs daemon and emacsclient environment inheritance across session managers
0 reputation · 08 Jun 2026, 20:50 UTC
Goal
Run an Emacs daemon under a systemd user unit and connect with emacsclient from an interactive shell so that subprocesses started inside Emacs see the same PATH and display variables as the shell.
Constraint
The daemon inherits its environment from the service manager, while emacsclient inherits from the invoking shell. Variables such as PATH, DISPLAY, WAYLAND_DISPLAY, and SSH_AUTH_SOCK can diverge. exec-path-from-shell and setenv populate the running editor, but no standard mechanism retroactively refreshes an already-running daemon for every subsystem, and behavior varies across Emacs releases.
Is there a supported way to synchronize an existing Emacs daemon's environment with a newly invoked emacsclient's environment? Which variables are safe to set after daemon startup, and does the answer depend on the Emacs major version?