[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question about pop-to-buffer
From: |
Thierry Volpiatto |
Subject: |
Re: question about pop-to-buffer |
Date: |
Sat, 29 Sep 2012 21:20:37 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
martin rudalics <address@hidden> writes:
>> how can I set pop-to-buffer action arg to create the new window on top
>> and not on bottom of current window and split the windows equally.
>
> Side windows serve a different purpose and don't care about the selected
> window. Moreover you can't set their heights and widths individually:
> All side windows on the left or right get the same width once set, all
> side windows on the top or bottom have the same height. And you
> currently can't set the size of the first window at some side because
> there's a bug in `display-buffer-in-major-side-window' :-(
>
> So in `display-buffer-in-major-side-window' you have to replace
>
> (size (or (assq 'size alist)
>
> by
>
> (size (or (cdr (assq 'size alist))
>
> and then use for example
>
> (pop-to-buffer
> (get-buffer-create "*toto*")
> `(display-buffer-in-side-window . ((side . top) (size . ,(/
> (window-total-size (selected-window)) 2)) (slot . 0))))
>
> which is clumsy and won't work if a window of that size exists already.
>
> Interpreting your request literally with "selected" substituting
> "current", I suppose the following should do what you want:
>
> (let ((split-window-preferred-function
> #'(lambda (window) (split-window (selected-window) nil 'above))))
> (pop-to-buffer (get-buffer-create "*toto*")))
>
>> Also if I have two windows the second one is not reused, a new one is
>> created instead. (but maybe is what `display-buffer-in-side-window' for
>> ?)
>
> I suppose you have to customize `window-sides-slots' appropriately.
Many thanks to take the time to clarify all this.
--
Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997