How can I make Emacs run in terminal (or console) mode by default, as if I'd used -nw
? And once that's done, how do I force it to run in GUI mode (once) if I need to?
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.
To start Emacs without a GUI window, use the -nw (no window) flag on the command line. To access the menus without the mouse, use M-` . In non-emacspeak, that means press Esc, let go, then press the backtick. You will get a list of the menu functions in the minibuffer that you can scroll and select with the Enter key.
If you are working with a graphical user interface, start Emacs by clicking its icon or by running emacs & at the command line. The & tells the command line to open Emacs in the background and immediately return control of the terminal to you.
If you forget the ampserand, you can put emacs into the background by first suspending it (giving it the C-x C-z command key sequence) and then typing the bg command into the shell window.
On my Debian testing, alias emacs='emacs -nw'
followed by emacs
opens Emacs in the terminal. And, in the same session, emacs23-x
opens Emacs with the GUI.
In case you decide to use emacs in terminal mode always, install emacs-nox (emacs with no X support).
After installationis still ran by $ emacs so you no need to create aliases again!:)
Its there in repos of Debian Squeeze so must be in Ubuntu also.
This answer suggests the method I found works best for me (was having problems with aliases). Essentially, create an executable script
#!/bin/sh
emacs -nw "$@"
and point $EDITOR
to it in your shell rc file.
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