Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make emacs run in console mode (-nw) by default

Tags:

emacs

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?

like image 557
Ben Dilts Avatar asked Feb 28 '11 21:02

Ben Dilts


People also ask

How do I run 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.

How do I use Emacs without GUI?

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.

How do I start Emacs GUI?

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.

How do I open Emacs in the background?

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.


3 Answers

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.

like image 61
vpit3833 Avatar answered Nov 04 '22 18:11

vpit3833


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.

like image 23
kgaipal Avatar answered Nov 04 '22 19:11

kgaipal


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.

like image 4
metakermit Avatar answered Nov 04 '22 19:11

metakermit