From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#1806: dired-pop-to-buffer in wrong place Date: Wed, 07 Jan 2009 19:47:59 +0200 Organization: JURTA Message-ID: <87aba3qb5g.fsf@jurta.org> References: <87r63gzcap.fsf@jurta.org> <496395F6.8050409@gmx.at> <87prj0uxq8.fsf@jurta.org> <4963A229.1030609@gmx.at> <87aba4qh1b.fsf@jurta.org> <496483A8.8010805@gmx.at> <87d4ezuw6w.fsf@jurta.org> <4964CB72.1090605@gmx.at> Reply-To: Juri Linkov , 1806@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1231352994 917 80.91.229.12 (7 Jan 2009 18:29:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Jan 2009 18:29:54 +0000 (UTC) Cc: 1806@emacsbugs.donarmstrong.com To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jan 07 19:31:05 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LKdBE-0003PJ-3N for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Jan 2009 19:31:00 +0100 Original-Received: from localhost ([127.0.0.1]:35173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKd9y-0003eo-8K for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Jan 2009 13:29:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKd41-0000NJ-Jt for bug-gnu-emacs@gnu.org; Wed, 07 Jan 2009 13:23:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKd3y-0000KP-Lh for bug-gnu-emacs@gnu.org; Wed, 07 Jan 2009 13:23:30 -0500 Original-Received: from [199.232.76.173] (port=52197 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKd3w-0000JW-Qe for bug-gnu-emacs@gnu.org; Wed, 07 Jan 2009 13:23:28 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:51145) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LKd3v-0002lJ-Hf for bug-gnu-emacs@gnu.org; Wed, 07 Jan 2009 13:23:28 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n07INOva007002; Wed, 7 Jan 2009 10:23:25 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n07I59Km002732; Wed, 7 Jan 2009 10:05:09 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Juri Linkov Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 07 Jan 2009 18:05:09 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 1806 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1806-submit@emacsbugs.donarmstrong.com id=B1806.123135098632567 (code B ref 1806); Wed, 07 Jan 2009 18:05:09 +0000 Original-Received: (at 1806) by emacsbugs.donarmstrong.com; 7 Jan 2009 17:56:26 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from relay01.kiev.sovam.com (relay01.kiev.sovam.com [62.64.120.200]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n07HuM3f032552 for <1806@emacsbugs.donarmstrong.com>; Wed, 7 Jan 2009 09:56:23 -0800 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1LKcdm-000Clo-7h; Wed, 07 Jan 2009 19:56:26 +0200 In-Reply-To: <4964CB72.1090605@gmx.at> (martin rudalics's message of "Wed, 07 Jan 2009 16:34:10 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: efe3bc1504fa577d936f03857ce6b673 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Trusted X-SpamTest-Info: Profiles 5467 [Oct 22 2008] X-SpamTest-Info: {received from trusted relay: common white list} X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: white ip list X-SpamTest-Rate: 10 X-SpamTest-Status: Trusted X-SpamTest-Status-Extended: trusted X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Wed, 07 Jan 2009 13:23:30 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23881 Archived-At: > Usually this worked correctly due to the fact that directory buffers > were sufficiently high. But for `pop-up-frames' non-nil addicts this > was not necessarily the right behavior. > > Anyway, I suppose you mean something like > > (defun dired-pop-to-buffer (buf) > (let* ((split-height-threshold 8) > split-width-threshold > (buffer (get-buffer-create buf)) > (window (window--try-to-split-window (selected-window)))) > (if window > (progn > (select-window window) > (set-window-buffer window buffer)) > (pop-to-buffer buffer)) > (when dired-shrink-to-fit > (fit-window-to-buffer nil nil 1)))) Thank you, this works almost ideally. The only problem I've encountered is that sometimes it resizes existing windows: +------------+------------+ +------------+------------+ | | | | | | | | | | | | | dired | other2 | | dired | other2 | | | | | | | | | | +------------+ | | | | | file list | | | | | ===> +------------+ | +------------+ | | | | | | | | | | | other1 | | | other1 | | | | | | | | | | | | | | +------------+------------+ +------------+------------+ Please notice how the upper border of the lower window (other1) was moved up. I think it should keep the existing configuration and create a new window at the cost of space from the original dired buffer like this: +------------+------------+ +------------+------------+ | | | | | | | | | | | | | dired | other | | dired | other | | | | | | | | | | | | | | | | +------------+ | | | | | file list | | +------------+ | ===> +------------+ | | | | | | | | other | | | other | | | | | | | | | | | | | | +------------+------------+ +------------+------------+ As I can see currently `fit-window-to-buffer' always takes space from the bottom window, but we need it from the top window. >> Please see the code in calendar.el that creates such standard layout >> for non-wide-screen configurations (i.e. when there is no right window). >> I think we should keep exactly the same logic for wide-screen configurations, >> i.e. treating the creation of such small low windows as if there is no >> existing side window. > > Would the above code handle that? I believe it would handle these cases. Maybe it is possible to create a single function e.g. `pop-to-buffer-below' that will display a new window below from the current window taking its space. -- Juri Linkov http://www.jurta.org/emacs/