3

I often keep a "short" secondary window below my main window with an arrangement like so:

+---------+
|         |
|         |
|   top   |
|         |
|         |
|         |
+---------+
|         |
| bottom  |
|         |
+---------+

The bottom window typically contains, *compilation*, *grep*, *Shell*, *Help*, etc. I typically keep a 80%-20% top-bottom split, but I find myself having to maintain this manually. Whenever I open certain new mode types like Help they often grow the bottom window to a 50-50 split with top. Is there any way for me to preserve this arrangement even when invoking these alternative modes like Help or compilation?

b4hand
  • 1,995
  • 1
  • 19
  • 31
  • 1
    You might want to look at `golden-ratio` mode from MELPA. It automatically expands the focused window to maintain the golden ratio. You can see it in action [here](https://github.com/roman/golden-ratio.el) – Vamsi Sep 27 '14 at 03:01

2 Answers2

1

The popwin package might be what you want. It's available on Melpa.

It doesn't persistently keep the *Help*, *Completion*, etc windows persistently open, but you can set the size and position where they can open. The best part is that those windows close automatically, recovering the precious screen area.

Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179
  • Personally, I like keeping them open until I'm "done" with them, and usually I just `C-x 0` or `C-x k` the ones I no longer care about. However, this still doesn't address the issue of the modification of the window size when I go back to what I was doing before. – b4hand Sep 26 '14 at 23:06
  • You can keep those temporary windows open until you press `C-g`. These temporary windows behave as "popup" windows in the sense that the original window sizes don't get modified. They would the same sizes before and after popups. I find this especially useful after package updates, opening key binding and function helps, etc – Kaushal Modi Sep 26 '14 at 23:14
  • Ok, I see. After looking more at popwin, it appears that I would get 3 divisions when a popup window occurs, and then I would go back to the 2 divisions with `C-g`. That's a little different than my normal usage which is just to maintain at most 2 divisions. The popup windows should still pop up in place of the bottom window. I think I will try out popwin to see if I like it, but having 3 windows will definitely be jarring to me at first. – b4hand Sep 26 '14 at 23:19
  • How would you use popwin here? – Gilles 'SO- stop being evil' Sep 27 '14 at 01:12
  • 1
    If you prefer to have at most 2 divisions, don't split the window in default mode of operation. When a Help, Completion, grep, etc window needs to open, you will get 2 windows. On pressing C-g in that window, that window will disappear and you will be back to the single window configuration. May be I misunderstood the question...? – Kaushal Modi Sep 27 '14 at 02:46
  • @kaushalmodi that makes more sense now. I definitely will try this solution out. – b4hand Sep 27 '14 at 05:49
  • The version of popwin in elpa doesn't seem to work, and the directions for installation from the github page didn't seem to work either. In particular, I could never get `(popwin-mode 1)` to not give an error in my `.emacs` file. – b4hand Oct 09 '14 at 18:04
  • @b4hand What error are you getting? I am on version `20140902.1727` and the only `popwin` related stuff I have in my `init.el` is `(popwin-mode 1)` after of-course `(require 'popwin)`. I installed it from MELPA using `package-install`. – Kaushal Modi Oct 09 '14 at 18:07
  • I used `package-install` as well. Here's the backtrace (popwin-mode 1) eval((popwin-mode 1) nil) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) – b4hand Oct 09 '14 at 18:10
  • @b4hand I would start by opening `popwin.el` in emacs and trying to load that file directly. That shouldn't through any error (it doesn't for me). If it does when launch emacs with -Q option and open that same file and try loading it again. – Kaushal Modi Oct 09 '14 at 18:14
0

It's possible the answer from this question may be applicable:

https://emacs.stackexchange.com/a/338/317

I haven't yet tried it, and am unfamiliar with display-buffer-alist, but maybe this will lead someone to come up with an example solution that would be applicable.

b4hand
  • 1,995
  • 1
  • 19
  • 31
  • 1
    Please don't post answers that are just links to somewhere else, even if that somewhere else is on the same site. What part of that answer is relevant? What if that answer was edited or deleted? – Gilles 'SO- stop being evil' Sep 27 '14 at 01:12
  • `display-buffer-alist` is the only relevant piece of information from the answer. I'll update the answer when I can verify that it actually is applicable, but it sounds like it will accomplish the desired behavior. – b4hand Sep 27 '14 at 05:44