8

I want to be able to open multiple files with Emacs like the following command:

emacs file1 file2

and have the Emacs screen -not- be split horizontally when Emacs starts up. Opening the files in different buffers is what I expected, with just one of the files displayed in the entire Emacs window.

So how do I do this?

user8153
4,1251 gold badge11 silver badges18 bronze badges
asked Jul 17, 2009 at 17:41

4 Answers 4

11
(add-hook 'window-setup-hook 'delete-other-windows)

works the way I want... just found that out after I asked here.

answered Jul 17, 2009 at 18:43
Sign up to request clarification or add additional context in comments.

Comments

1

Well, you can set up an (tcsh) alias like so

alias emacs emacs -eval '"(run-with-idle-timer 0 nil (quote delete-other-windows))"'

This makes emacs hide all the other windows (so you only have one). So your invocation

emacs file1 file2

is translated to

emacs -eval '"(run-with-idle-timer 0 nil (quote delete-other-windows))"' file1 file2
answered Jul 17, 2009 at 17:53

Comments

0

Nasty and hackish, but it works:

$ emacs -nw --eval "(mapcar 'find-file '(\"1.txt\" \"2.txt\"))"
answered Jul 17, 2009 at 17:58

Comments

-2

Or just press C-x 1 after the emacs has loaded.

Personally, I think you are misusing emacs if you invoke it from the command-line. I tend to visit files from within eshell, which is running inside emacs.

answered Jul 17, 2009 at 18:30

3 Comments

displaying multiple buffers at once is so valuable. With a big monitor I can have 4 buffers displayed and each one is usable. It's not typical that I need that, but when I do....
this would be a great answer if you actually explained how to visit files from within eshell, instead of just mentioning that you like to do so, or explained how one is supposed to cycle through the buffers having successfully opened them in non-split-screen mode.
You visit files from eshell with find-file.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.