all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Thierry Volpiatto <thierry.volpiatto@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: question about pop-to-buffer
Date: Sat, 29 Sep 2012 21:11:38 +0200	[thread overview]
Message-ID: <506747EA.3080906@gmx.at> (raw)
In-Reply-To: <87ipaxnfdy.fsf@gmail.com>

 > 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.

martin



  reply	other threads:[~2012-09-29 19:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-29 13:10 question about pop-to-buffer Thierry Volpiatto
2012-09-29 19:11 ` martin rudalics [this message]
2012-09-29 19:20   ` Thierry Volpiatto
2012-09-30 10:48   ` martin rudalics
2012-09-30 11:03     ` Thierry Volpiatto
2012-09-30 14:23       ` martin rudalics
2012-09-30 18:37         ` Thierry Volpiatto
2012-10-01 15:48           ` martin rudalics
2012-10-01 16:17             ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=506747EA.3080906@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    --cc=thierry.volpiatto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.