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#9873: 24.0.90; dired - window changes size when trying to delete more than one file Date: Mon, 31 Oct 2011 12:11:18 +0200 Organization: JURTA Message-ID: <87y5w15v5h.fsf@mail.jurta.org> References: <86y5w87bli.fsf@googlemail.com> <86r52079fq.fsf@googlemail.com> <4EA7D13C.8060801@gmx.at> <86ipnb6r1w.fsf@googlemail.com> <4EA92A02.2050904@gmx.at> <87vcr94jly.fsf@mail.jurta.org> <4EAAE35F.4030707@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1320056105 30310 80.91.229.12 (31 Oct 2011 10:15:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 31 Oct 2011 10:15:05 +0000 (UTC) Cc: Christoph Scholtes , Juanma Barranquero , 9873@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 31 11:15:00 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RKotN-0007XM-91 for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Oct 2011 11:14:57 +0100 Original-Received: from localhost ([::1]:44521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKotM-0007eH-3w for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Oct 2011 06:14:56 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKotJ-0007e3-Mn for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2011 06:14:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RKotI-0000Y4-Bd for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2011 06:14:53 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50931) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RKotI-0000Xw-60 for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2011 06:14:52 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RKovO-0007J9-KZ for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2011 06:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2011 10:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9873 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9873-submit@debbugs.gnu.org id=B9873.132005620328059 (code B ref 9873); Mon, 31 Oct 2011 10:17:02 +0000 Original-Received: (at 9873) by debbugs.gnu.org; 31 Oct 2011 10:16:43 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RKov4-0007IU-9S for submit@debbugs.gnu.org; Mon, 31 Oct 2011 06:16:43 -0400 Original-Received: from smarty.dreamhost.com ([208.113.175.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RKov0-0007IG-A9 for 9873@debbugs.gnu.org; Mon, 31 Oct 2011 06:16:39 -0400 Original-Received: from ps18281.dreamhostps.com (ps18281.dreamhost.com [69.163.218.105]) by smarty.dreamhost.com (Postfix) with ESMTP id 995776E814B; Mon, 31 Oct 2011 03:14:26 -0700 (PDT) Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id B7A6B451C5C1; Mon, 31 Oct 2011 03:14:24 -0700 (PDT) In-Reply-To: <4EAAE35F.4030707@gmx.at> (martin rudalics's message of "Fri, 28 Oct 2011 19:16:15 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 31 Oct 2011 06:17:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:53340 Archived-At: >> Are we waiting for a conclusion whether to set `window-nest' to t by default >> or to bind it individually where necessary? > > Setting it to t by default and _not_ binding it individually will have > detrimental consequences for people who don't want it always t. Juanma > wants it always t because he wants to control the layout of his windows. > I'm more sloppy in this respect. Hence if we choose to handle this via > `window-nest' we should bind that individually. > >> Are there other options? > > You could try writing a suitable buffer display function ;-) Below is a new buffer display function created from `dired-pop-to-buffer' that can be used in all packages that need this functionality like Dired and Proced (more could be fixed later if this is the right approach): === modified file 'lisp/window.el' --- lisp/window.el 2011-10-30 08:29:56 +0000 +++ lisp/window.el 2011-10-31 10:05:16 +0000 @@ -4851,6 +4851,24 @@ (defun display-buffer-pop-up-window (buf (set-window-prev-buffers window nil) window))) +(defun display-buffer-pop-up-window-below (buffer alist) + "Display BUFFER by popping up a new window below the selected window." + (let ( + ;; Stay within the confines of the initial window. + ;; Don't resize other windows. (Bug#1806 Bug#9873) + (window-nest t) + (split-window-preferred-function + (lambda (window) + (or (and (let ((split-height-threshold 0)) + (window-splittable-p (selected-window))) + ;; Try to split the selected window vertically if + ;; that's possible. (Bug#1806) + (split-window-below)) + ;; Otherwise, try to split WINDOW sensibly. + (split-window-sensibly window)))) + pop-up-frames) + (display-buffer-pop-up-window buffer alist))) + (defun display-buffer--maybe-pop-up-frame-or-window (buffer alist) "Try displaying BUFFER based on `pop-up-frames' or `pop-up-windows'. === modified file 'lisp/dired.el' --- lisp/dired.el 2011-10-30 01:56:03 +0000 +++ lisp/dired.el 2011-10-31 10:06:19 +0000 @@ -2873,17 +2873,7 @@ (defun dired-mark-prompt (arg files) (defun dired-pop-to-buffer (buf) "Pop up buffer BUF in a way suitable for Dired." - (let ((split-window-preferred-function - (lambda (window) - (or (and (let ((split-height-threshold 0)) - (window-splittable-p (selected-window))) - ;; Try to split the selected window vertically if - ;; that's possible. (Bug#1806) - (split-window-below)) - ;; Otherwise, try to split WINDOW sensibly. - (split-window-sensibly window)))) - pop-up-frames) - (pop-to-buffer (get-buffer-create buf))) + (pop-to-buffer (get-buffer-create buf) '(display-buffer-pop-up-window-below)) ;; If dired-shrink-to-fit is t, make its window fit its contents. (when dired-shrink-to-fit ;; Try to not delete window when we want to display less than === modified file 'lisp/proced.el' --- lisp/proced.el 2011-08-24 18:09:18 +0000 +++ lisp/proced.el 2011-10-31 10:07:56 +0000 @@ -1730,8 +1730,7 @@ (defun proced-send-signal (&optional sig (save-window-excursion ;; Analogous to `dired-pop-to-buffer' ;; Don't split window horizontally. (Bug#1806) - (let (split-width-threshold) - (pop-to-buffer (current-buffer))) + (pop-to-buffer (current-buffer) '(display-buffer-pop-up-window-below)) (fit-window-to-buffer (get-buffer-window) nil 1) (let* ((completion-ignore-case t) (pnum (if (= 1 (length process-alist))