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.

It seems it' ok to use 'EDITOR=emacs',it open GUI emacs. If I use 'EDITOR=emacs -nw', it fails.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

There are many programs that launch an editor based on the EDITOR environment variable. Unfortunately, they disagree on whether that variable should contain a shell script snippet (so that you can pass options to the editor), or should contain the name of an executable file (which may happen to contain spaces).

The safe option is to write a short script that calls your editor with the options you want and give it a name that doesn't include any special characters. Here's a sample script:

#!/bin/sh
exec emacs -nw "$@"

Call that script /home/chenge/bin/EDITOR (for example) and set EDITOR=/home/chenge/bin/EDITOR.

Also set VISUAL to the same value (the two variables have the same purpose; most but not all programs understand both).

By the way, if you have Emacs 23, you may want to set up the Emacs daemon and call emacsclient instead of emacs.

share|improve this answer
    
Thanks,it works. I used emacsclient, but it has some problem while display Chinese chars in utf-8. –  chenge Jul 22 '10 at 3:27

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.