I use emacs fairly regularly and am trying to configure my system to use emacsclient when possible. To do this I have done the following:

In .bashrc:

EDITOR='emacsclient -ca emacs'
VISUAL='emacsclient -ca emacs'

I then also installed an alternative for /usr/bin/editor that points to /usr/local/bin/emacsclient.wrapper that has the following:

 #Start emacs client
 /usr/bin/emacsclient -ca emacs $1

For the most part this works great. However, when emacsclient is launched from the terminal, it often spews out text I don't need. Notably:

$ editor 
Waiting for Emacs...

Or, when emacs isn't already started and emacclient has to fall back to starting emacs itself:

emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

What can I do to surpress this output? I've tried changing my emacs wrapper to

     #Start emacs client
     /usr/bin/emacsclient -ca emacs $1 &> /dev/null

but this didn't help. I didn't try editing EDITOR or VISUAL since I don't have any ideas other than this standard redirection.

  • Replace $1 by "$@". The quotes are needed to pass file names containing spaces and other special characters, and "$@" will pass all arguments to emacsclient in case you ever want to edit several files at once or pass +LINE FILENAME to open a file at a certain line number. Sep 6, 2010 at 20:44

1 Answer 1


In general:

program >/dev/null 2>&1

will force the output (STDOUT) of program to /dev/null and redirects STDERR to STDOUT. So try:

/usr/bin/emacsclient -ca emacs $1 >/dev/null 2>&1
  • 2
    Gah! Immediately upon reading your response did I realize that &> is a bashism and was never going to work with #!/bin/sh.
    – Steven D
    Sep 6, 2010 at 7:14
  • @Steven Oh, good call. I tried it in sh to make sure, but sh is symlinked to bash on my computer Sep 6, 2010 at 7:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .