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

3

6

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

Critchfield answered 28/4, 2015 at 9:12 Comment(3)
(A) You can set a certain window as dedicated so that the display-buffer family of functions avoids it -- gnu.org/software/emacs/manual/html_node/elisp/… (B) You can adjust the display-buffer-alist to your liking -- gnu.org/software/emacs/manual/html_node/elisp/… and gnu.org/software/emacs/manual/html_node/elisp/… (C) You can adjust the source code of speedbar to your liking.Winther
I have tried (A), and I set the *shell* window as a dedication, but sr-speedbar insists in opening the file by spliting the last window(i.e. *shell*), and ignoring the scratch window.Critchfield
A cursory word-search of the sr-speedbar.el library for the term split-window pulls up two results: emacswiki.org/emacs/sr-speedbar.el I personally like option (C) -- modify the source and make it do what you want. Instead of split-window..., perhaps you want to use display-buffer to select an existing window? . . . (modifying the code as needed to accommodate that new revision).Winther
W
1

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.

Wier answered 6/5, 2015 at 18:11 Comment(0)
B
1

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 
Backward answered 19/11, 2018 at 13:49 Comment(1)
Thank you, this is exactly what I was looking for though I did not know what it was called.Outspan
L
0

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.

Luteous answered 23/11, 2018 at 16:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.