Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to set my $EDITOR variable to be emacs with no window, so the command to call it would be emacs -nw. However if I set it like this:

export EDITOR="/Applications/Emacs.app/Contents/MacOS/Emacs -nw"

I get the following error

zsh: no such file or directory: /Applications/Emacs.app/Contents/MacOS/Emacs -n

share|improve this question
    
Have you checked if the programs take environment variables of configuration files to set such switches? –  vonbrand Jan 23 '13 at 18:59

2 Answers 2

up vote 2 down vote accepted

I believe this doesn't work because the shell would try to open a binary with the space included in the file name, so Emacs -nw, and not open Emacs and then pass -nw as the options.

How about making $EDITOR a small (executable) script, e.g. in ~/bin/EDITOR?

#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs -nw -- "$@"

Then, simply add to your shell's configuration:

export EDITOR=~/bin/EDITOR

Now, EDITOR will call the script with the appropriate arguments, expanded in $@.

share|improve this answer

As explained here: http://stackoverflow.com/questions/8299610/zsh-command-not-found-for-editor, zsh treats the expanded variable as a single word (that has space characters in it).

Possible solutions are:

share|improve this answer

Your Answer

 
discard

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.