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?
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.
If you are working with a command line interface with no option to start GUI application, start Emacs directly in the terminal with 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.
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.
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
I'm using a bash alias instead of .emacs to do that.
Add this line to your ~/.bashrc.
alias emacs='emacs -nw'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With