I'm using Ubuntu 11.10 (Oneiric Ocelot). When I type the command "emacs" in the terminal, it opens Emacs as a separate window. How can I open it inside the terminal, like the nano editor?
-
As always when I see a such question, I wonder why you would want to do that. With a graphical emacs you could use every fonts you want, nice colorscheme, use the image support, etc …Daimrod– Daimrod2012-01-05 19:40:02 +00:00Commented Jan 5, 2012 at 19:40
-
38@Daimrod: sometimes a new window popping up harrasses the concentrated mind. Sometimes you want to do a quick one in an existing window and sometimes you want to reserve a whole room for your thing.mike3996– mike39962012-01-05 22:24:37 +00:00Commented Jan 5, 2012 at 22:24
-
13@Daimrod because sometimes you're editing files across two ssh hops on a slow link and the X version of emacs is too much for your connection.Trebor Rude– Trebor Rude2015-03-05 22:07:11 +00:00Commented Mar 5, 2015 at 22:07
-
6Also, one might want to practice using Emacs in terminal mode.cammil– cammil2016-10-30 09:50:44 +00:00Commented Oct 30, 2016 at 9:50
-
2@Daimrod it's also useful for pairing across a service like tmatePaul Byrne– Paul Byrne2019-05-11 05:45:20 +00:00Commented May 11, 2019 at 5:45
8 Answers
Emacs takes many launch options. The one that you are looking for is
emacs -nw. This will open Emacs inside the terminal disregarding the DISPLAY environment variable even if it is set.
The long form of this flag is emacs --no-window-system.
More information about Emacs launch options can be found in the manual.
Comments
In the spirit of providing functionality, go to your .profile or .bashrc file located at /home/usr/ and at the bottom add the line:
alias enw='emacs -nw'
Now each time you open a terminal session you just type, for example, enw and you have the Emacs no-window option with three letters :).
Comments
If you need to open Emacs without X:
emacs -nw
2 Comments
I didn't like the alias solution for my purposes. For one, it didn't work for setting export EDITOR="emacs -nw".
But you can pass --without-x to configure and then just the regular old Emacs will always open in terminal.
curl http://gnu.mirrors.hoobly.com/emacs/emacs-25.3.tar.xz
tar -xvzf emacs-25.3.tar.xz && cd emacs-25.3
./configure --without-x
make && sudo make install
1 Comment
emacs hello.c -nw
This is to open a hello.c file using Emacs inside the terminal.