Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.emacs Edit to Always Start Emacs in Terminal Mode?

I use emacs as my editor-of-choice, and since I'm doing a lot of work in a terminal I always run emacs as

emacs -nw

so that it runs in the terminal instead of in a window.

I'd like to just run emacs and have it know that it should run in a terminal. My question is - how do I edit my .emacs file so that this is the default behavior?

like image 600
templatetypedef Avatar asked Jan 05 '11 20:01

templatetypedef


People also ask

How do I start emacs in terminal mode?

To enter Emacs, type emacs at the shell prompt. When you want to leave Emacs for a short time, type a C-z and Emacs will be suspended. To get back into Emacs, type %emacs at the shell prompt. To quit Emacs permanently, type C-x C-c.

Can I use emacs in terminal?

If you are working with a command line interface with no option to start GUI application, start Emacs directly in the terminal with emacs .

How do I invoke emacs?

The usual way to invoke Emacs is with the shell command emacs . From a terminal window running a Unix shell on a GUI terminal, you can run Emacs in the background with emacs & ; this way, Emacs won't tie up the terminal window, so you can use it to run other shell commands.

How do I close emacs on Mac?

To close emacs, type C-x, C-c, which is shorthand for typing the Control and x key, followed by the Control and c key.


2 Answers

You can't do this in the .emacs file. By the time that file is being parsed, the "chosen" emacs binary is already running.

You can install the emacs-nox package as one commenter suggests, or create an alias in your shell so that "emacs" is always treated as "emacs -nw".

Randy

like image 178
rjray Avatar answered Sep 21 '22 03:09

rjray


I'm using a bash alias instead of .emacs to do that.
Add this line to your ~/.bashrc.

alias emacs='emacs -nw'
like image 36
tototoshi Avatar answered Sep 18 '22 03:09

tototoshi