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 know to start emacs with no window system, I do:

emacs -nw filename.txt

But, I don't want to specify -nw constantly. What do I add in my .emacs to do this automatically?

share|improve this question
add comment

4 Answers

up vote 5 down vote accepted

Depending on platform in shell, I believe you could add an alias in your bashrc or bash_profile (depending on needs) so that emacs is interpreted as emacs -nw

share|improve this answer
2  
I think this answer is as good as it is going to get. I ran an experiment of setting the variable 'window-system to nil as the only thing done in the .emacs file and then started emacs from a terminal. As expected, it had no effect. As an alternative to using an alias, one could use a script (emacs.sh or emacs.bat) instead of invoking the executable directly. –  pmr Feb 9 '11 at 7:34
add comment

You can choose to install the non graphical version of emacs, under OSX I have the package "emacs @23.2, Revision 5 (editors): installed via MacPorts so when I type 'emacs' it never shows a GUI. off course aliasing (as suggested in another answer) leaves you with the option to run the graphical version sometimes.

share|improve this answer
add comment
  1. Open your ~/.bash_profile and put this in a new line: alias emacs="emacs -nw"
  2. Save the file.
  3. Applying the change everywhere and immediately is simplest if you just log out and then log back in.
share|improve this answer
add comment

As a slightly more extensive example ...

Here is a snippet from my local .bashrc

  ## grrrr me type bad
    alias emasc='emacs -nw'
    alias emacs='emacs -nw'
    alias emacsx='emacs23-x'
    alias ls='ls --color'

That does it for me.

Also if your using emacs in a "real" console it detects the absence of a windowing environment and starts correctly without an alias .

i.e.

ctrl + alt + F[1-6]

You could also set your EDITOR env variable (in bashrc)

Finally you could uninstall any GUI versions :)

on debian:

apt-get install emacs23-nox 

would most probably do it all for you.

share|improve this answer
add comment

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.