Tim Retout's www presence

Fri, 16 Jul 2010

Starting the Emacs daemon

The daemon feature of Emacs is great. But when should the daemon be started?

At one time I used an '@reboot' line in my crontab. But when you want to use things like Tramp mode (for editing files on remote servers transparently), you very quickly wish that emacs could talk to your ssh-agent.

So if you accept that you will be running a desktop environment (not always true), you can add the daemon to your equivalent of "System >> Preferences >> Startup Programs".

But then you find that Flymake (when used with cperl-mode) is not picking up any of your uninstalled, work-in-progress Perl modules. Wouldn't it be great if you could set $PERL5LIB to fix this? And doesn't M-x copyright require you to set "$ORGANIZATION"?

Ever since Debian bug #411639 was fixed at the end of 2007, we have the option of "~/.xsessionrc" for setting environment variables that will cover everything in your desktop session, including things launched from panels and startup scripts.

So now that's what I do. But I've yet to figure out a good equivalent for console-only systems. Maybe I don't need one?

Posted: 16 Jul 2010 23:48 | Tags: , , , | Comments (5)

Comments

Posted by Josh Triplett at Sat Jul 17 00:03:45 2010
I personally have a ~/.environment containing nothing but variable settings and export commands, and I source it from various places, including ~/.bashrc and ~/.xsession.

Posted by Pitt Boffin at Sat Jul 17 08:16:48 2010
If ALTERNATE_EDITOR is the empty string, emacsclient -nc
will start emacs in deamon mode, if it is not already running.

Posted by tomás zerolo at Sat Jul 17 09:02:33 2010
What happened to PAM session? Would that not be the canonical way to do such things in Linux (i.e. setting the ssh agent, starting the Emacs daemon on behalf of the user, etc.)?

(Btw: I liked the captcha a lot -- cool idea :)

Posted by Andreas Marschke at Mon Jul 19 17:16:54 2010
This is a snippet from my personal ~/.bash_alias which solved alot of the startup and background issues with emacs for me.

function emacs()
{
  if [ -x /tmp/emacs1000/server ];then
  emacsclient -nw $@
  else
  screen emacs -nw -f server-start $@
  fi
}
This way I can keep a screen

Posted by Gunnar at Mon Jul 26 18:55:34 2010
I used an idea similar to Andreas' (only as ~/bin/emacs, which is earlier on the search path), but ended up discarding it - every now and then emacs-daemon died on me, and it became increasingly annoying, so I decided to go back to regular use. Long time ago, yes, and it might be fixed by now.

Name:


E-mail:


URL:


Comment:


Anti-spam question: What is the colour of both (hydrated) copper sulphate and (anhydrous) cobalt chloride?

< July 2010 >
SuMoTuWeThFrSa
     1 2 3
4 5 6 7 8 910
11121314151617
18192021222324
25262728293031

Contact

Tim Retout tim@retout.co.uk
JabberID: tim@retout.co.uk

List of non-fail

Copyright © 2007, 2008, 2009 Tim Retout