That's the short email communication I had with Ulrich Müller (ulm): >> 1. I'd like to have control over the environment the emacs process is >> started in. It would be very nice if in conf.d/emacs I could add >> something like >> >> EMACS_ENV_FILE="${HOME}/.profile" >> >> which would be sourced before starting emacs. > > Do you have any suggestion how this should be implemented? We cannot > source a file owned by the user while we are being root, because that > would be a security issue. At the moment only an intermediate shell > between start-stop-daemon and Emacs comes to my mind, but that doesn't > look like te most elegant solution ... Currently I see 2 possibilities: 1. start-stop-daemon supports an "-e, --env VAR=VALUE" option. So I guess one could add a variable to the conf.d/emacs file which lists var-value pairs. Or maybe a conf.d/emacs.user would be better. But I guess that's not a too good solution, because then users would have to duplicate their envvar settings. I have them all in ~/.profile and wouldn't like to add the same with other syntax to another config file. 2. Implement a source function in elisp which parses an EMACS_ENV_FILE set in conf.d/emacs and uses the builtin `setenv' function. I guess that shouldn't be too hard to do. That function could be added as site-lisp file, I think. If no-one comes up with a better solution, I'd volunteer to give 2 a try. Reproducible: Always
It seems that point 2 doesn't work. I tried expanding my PATH using M-x setenv RET PATH RET $PATH:/home/horn/bin RET and M-x getenv shows that the value is just like I wanted, but when I hit RET on a link which should launch "conkeror" which is located in that directory, it won't be found. apply: Searching for program: no such file or directory, conkeror
How about the following: We add a variable EMACS_LAUNCHER (any better suggestion for the name?) in conf.d/emacs, with an empty default value. The init script's start function would then call "start-stop-daemon --exec ${EMACS_LAUNCHER:-${EMACS}}". This should allow for maximum flexibility. As added bonus we could install a default start-emacs-daemon script (probably this should then go into /usr/libexec/) with the following contents: #!/bin/bash -l exec "${EMACS}" "$@" (In reply to comment #0) > Or maybe a conf.d/emacs.user would be better. This is called "multiplexing" and already working. I'll add a respective comment to conf.d/emacs.
The EMACS_LAUNCHER option sounds just perfect!
2008-11-13 Ulrich Mueller <ulm@gentoo.org> * emacs.rc (start): Allow for a wrapper script specified by variable EMACS_START. Thanks to Tassilo Horn, bug 246460. * emacs.conf (EMACS_START): Document as a variable. * emacs-wrapper.sh: New file. * Makefile (DISTFILES): Add emacs-wrapper.sh. * emacs.conf: Add a comment about multiplexed configuration files.
Using emacs-daemon-9999 the emacs-wrapper.sh is not installed.
It should, see: http://overlays.gentoo.org/proj/emacs/changeset/1206 Did you re-sync the overlay?
Ups, you're right. I forgot that. Now it works just beautiful. Thanks a lot!
Fixed in emacs-daemon-0.6. Thank you for the suggestion.
Just for info: The wrapper script is now called by default. I've also added a start timeout, in order to avoid a hanging runscript (which is quite nasty at boot time). It might be worthwhile to test this again, emacs-daemon-9999, in Emacs overlay.