Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open the files only in a specific window in Emacs?

I have configured my emacs as follows, and I would like to open and operate the source files only in the first window(*scratch*).

But the sr-speedbar loves to open the new file in the lastest window(e.g. the newly open *shell* window).

How can I stop it from opening files in some unwanted windows?

enter image description here

like image 321
ppn029012 Avatar asked Apr 28 '15 09:04

ppn029012


People also ask

How do I open multiple files in Emacs?

Much better to use the multiple buffer feature of emacs. If you are editing the first file and want to start editing the second file, simply use the hot key C-x C-f or the menu selection File->Open File to start the second file. The second file is loaded into its own buffer.

How do I open multiple Emacs windows?

Splitting WindowsThe command C-x 2 ( split-window-vertically ) breaks the selected window into two windows, one above the other. Both windows start out displaying the same buffer, with the same value of point.

Can you only have one buffer open in Emacs at a time?

You can have several buffers open at once, but can edit only one at a time. Several buffers can be visible at the same time when you're splitting your window.

How do I access files in Emacs?

Use Ctrl-x f to open a file from within Emacs. Create a new file in the same way as opening a file by specifying the new filename.


1 Answers

I've run into this problem as well. My solution, which I can personally recommend, is to use the purpose package.

It allows you to dedicate specific windows to specific "purposes" which each have user-configurable associated modes; for instance, the edit purpose might have prog-mode associated with it, the view purpose might have `info-mode associated with it, etc. Any time a new buffer is to be opened, if there is a window currently dedicated to that purpose, Emacs will force said buffer to be opened in that dedicated window.

As an example, my default Emacs "workspace" consists of one large edit window, one comm window for IRC, and two admin windows -- one for RSS and another for email.

Highly recommend.

like image 72
Jonathan Jin Avatar answered Sep 18 '22 23:09

Jonathan Jin