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

1.5k Views Asked by At

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

3

There are 3 best solutions below

1
On

To open only in single windows do customize the emacs initialization file (in Ubuntu (18.04.01) it in (~/.emacs ) and add the

(setq inhibit-splash-screen t)       ;; Don't show initial Emacs-logo and info 
0
On

What I do is set the buffers that I do not want to change to sticky-buffer-mode. (Just do M-x sticky-buffer-mode when you have the buffer selected). Use this command to toggle the mode. A sticky buffer will not change, so if you make your shell sticky you should get what you want.

0
On

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.