Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my .bashrc, I define TMPDIR=${HOME}/tmp so temporary files are under my encrypted $HOME. emacs, invoked from the launcher, doesn't see this definition, but emacsclient, invoked from a shell does.

So far, I know that emacs (after (server-start)) opens a socket in '/tmp', 'emacsclient' tries to communicate with 'emacs' over a socket in '${HOME}/tmp', and does very poorly. How can I presuade the launcher (via emacsclient.desktop?) to pass the right value for TMPDIR?

share|improve this question tells me I can't use .desktop files ;-( – waltinator Oct 3 '11 at 0:54
up vote 1 down vote accepted

Try putting the variable definition in .profile instead of .bashrc. The latter has a statement near the top that causes it to exit very early when executed by a non-interactive shell. Log out and back in to see whether it works.

Also don't forget to add export like this:

export TMPDIR="$HOME/tmp"

If that doesn't work, modify the launcher (it's in /usr/share/applications) so that its Exec line says:

Exec=sh -c 'TMPDIR="$HOME/tmp" emacs'
share|improve this answer
Putting the definition in ~/.profile worked! Thanks. It's a much better solution. – waltinator Oct 6 '11 at 6:08

I guess I can't pass my TMPDIR in to the emacs server-start function, so I guess I'll have to make emacsclient use /tmp to hold the socket.

In my .bashrc:

export EDITOR="env TMPDIR=/tmp emacsclient"
export VISUAL="env TMPDIR=/tmp emacsclient"

but that seems sub-optimal. Any suggestions?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.