From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: question about pop-to-buffer Date: Sat, 29 Sep 2012 21:11:38 +0200 Message-ID: <506747EA.3080906@gmx.at> References: <87ipaxnfdy.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1348945912 31061 80.91.229.3 (29 Sep 2012 19:11:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Sep 2012 19:11:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thierry Volpiatto Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 29 21:11:58 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TI2SE-0006QN-28 for ged-emacs-devel@m.gmane.org; Sat, 29 Sep 2012 21:11:58 +0200 Original-Received: from localhost ([::1]:37954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TI2S8-000602-JL for ged-emacs-devel@m.gmane.org; Sat, 29 Sep 2012 15:11:52 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TI2S6-0005zm-47 for emacs-devel@gnu.org; Sat, 29 Sep 2012 15:11:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TI2S5-0000kP-8n for emacs-devel@gnu.org; Sat, 29 Sep 2012 15:11:50 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:34739) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TI2S4-0000kI-Uq for emacs-devel@gnu.org; Sat, 29 Sep 2012 15:11:49 -0400 Original-Received: (qmail invoked by alias); 29 Sep 2012 19:11:46 -0000 Original-Received: from 62-47-52-74.adsl.highway.telekom.at (EHLO [62.47.52.74]) [62.47.52.74] by mail.gmx.net (mp069) with SMTP; 29 Sep 2012 21:11:46 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18Jkhox+b0JeszUPTnOg/y07j5hhRzkcqXyjYckJm +imCavm70MqNs6 In-Reply-To: <87ipaxnfdy.fsf@gmail.com> X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.165.64.23 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153713 Archived-At: > 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