1

I want to use emacs command as a substitution for emacsclient -c -a "", which according to man connects to an existing emacs daemon, or creates a new daemon and connects to it otherwise. So i created a shell script emacs, which calls the aforementioned command in my ~/bin, which itself is included in $PATH. But when i run emacs, it repeats the following numerously:

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

and then also numerously:

Error: Could not start the Emacs daemon

The content of ~/bin/emacs is:

#!/bin/bash
emacsclient -c -a ""

According to Emacs devs, emacsclient internally calls emacs from $PATH, so calling it enters an infinite recursion. What should i do, so i can use custom emacs executable with the same behavior?

  • The content of your wrapper is? – jirib Jun 11 '12 at 16:01
3

Not directly an answer but how about making a shell alias instead of writing your custom script, e.g:

alias emacs='emacsclient -c -a ""'

This allows you to type emacs in your interactive shell and everything should work out of the box.

Another idea is that you either modify PATH in your ~/bin/emacs script and exclude ~/bin/ or export a variable before running emacsclient and check in your script if the variable is set and run the original emacs command instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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