From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: don@donarmstrong.com (Emacs bug Tracking System) Newsgroups: gmane.emacs.bugs Subject: bug#1488: marked as done (23.0.60; dired-pop-to-buffer: use fit-window-to-buffer) Date: Thu, 11 Dec 2008 02:05:06 -0800 Message-ID: References: <4940E3E8.8050501@gmx.at> <87fxl446mr.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----------=_1228989905-22284-0" X-Trace: ger.gmane.org 1228991091 22184 80.91.229.12 (11 Dec 2008 10:24:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Dec 2008 10:24:51 +0000 (UTC) To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 11 11:25:55 2008 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 1LAijq-0008Kh-FB for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Dec 2008 11:25:47 +0100 Original-Received: from localhost ([127.0.0.1]:51323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAiie-0002TK-Rb for geb-bug-gnu-emacs@m.gmane.org; Thu, 11 Dec 2008 05:24:32 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAiiY-0002Q3-0n for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 05:24:26 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAiiW-0002Ob-Nk for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 05:24:25 -0500 Original-Received: from [199.232.76.173] (port=50589 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAiiW-0002OH-EB for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 05:24:24 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:45080) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LAiiU-00034F-GM for bug-gnu-emacs@gnu.org; Thu, 11 Dec 2008 05:24:23 -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 mBBAOIhj028531; Thu, 11 Dec 2008 02:24:18 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mBBA55RS022783; Thu, 11 Dec 2008 02:05:06 -0800 X-Mailer: MIME-tools 5.420 (Entity 5.420) X-Loop: don@donarmstrong.com X-Emacs-PR-Message: closed 1488 X-Emacs-PR-Package: emacs X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:23166 Archived-At: This is a multi-part message in MIME format... ------------=_1228989905-22284-0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Your message dated Thu, 11 Dec 2008 10:56:56 +0100 with message-id <4940E3E8.8050501@gmx.at> and subject line Re: bug#1488: 23.0.60; dired-pop-to-buffer: use fit-window= -to-buffer has caused the Emacs bug report #1488, regarding 23.0.60; dired-pop-to-buffer: use fit-window-to-buffer to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact don@donarmstrong.com immediately.) --=20 1488: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3D1488 Emacs Bug Tracking System Contact don@donarmstrong.com with problems ------------=_1228989905-22284-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-8.0 required=4.0 tests=BAYES_00,MURPHY_DRUGS_REL8, RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 4 Dec 2008 09:44:23 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB49iJM7013570 for ; Thu, 4 Dec 2008 01:44:21 -0800 Received: from mail.gnu.org ([199.232.76.166]:58084 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1L8AkQ-0000TD-VK for emacs-pretest-bug@gnu.org; Thu, 04 Dec 2008 04:43:51 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1L8Akq-0004JT-Fz for emacs-pretest-bug@gnu.org; Thu, 04 Dec 2008 04:44:18 -0500 Received: from mail.gmx.net ([213.165.64.20]:54300) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1L8Akp-0004JA-MU for emacs-pretest-bug@gnu.org; Thu, 04 Dec 2008 04:44:16 -0500 Received: (qmail invoked by alias); 04 Dec 2008 09:44:13 -0000 Received: from i59F558DC.versanet.de (EHLO escher.local.home) [89.245.88.220] by mail.gmx.net (mp025) with SMTP; 04 Dec 2008 10:44:13 +0100 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX1/NGFNr8N7NDL9WOtlKqby9n1JW8TEtQU27dZYN89 G05ZVNVvcCRZ95 Received: by escher.local.home (Postfix, from userid 1000) id B140B7FF56; Thu, 4 Dec 2008 10:44:12 +0100 (CET) From: Stephen Berman To: emacs-pretest-bug@gnu.org Subject: 23.0.60; dired-pop-to-buffer: use fit-window-to-buffer Sender: steve@escher.local.home Date: Thu, 04 Dec 2008 10:44:12 +0100 Message-ID: <87fxl446mr.fsf@escher.local.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Y-GMX-Trusted: 0 X-FuHaFi: 0.54,0.78 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. --=-=-= In GNU Emacs 23.0.60.21 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of 2008-12-03 on escher 1. emacs -Q 2. Eval this: (define-minor-mode my-mm () "My minor mode." :global t (if my-mm (setq default-header-line-format '(:eval (propertize "test" 'face '(:overline t)))) (setq default-header-line-format nil))) 3. Enable my-mm. 4. C-x d foo (where `foo' is some directory with at least three files, e.g. emacs/lisp). 5. Mark three files in foo. 6. Type `C' ==> The popped up buffer *Marked Files* shows only two of the three marked files. Likewise if the value of the 'face property in my-mm has a non-nil :box attribute. In contrast, if the value of the 'face property is '(:underline t) (but not '(:underline t :overline t)), then in step 6 all three marked files are shown, though with no room to spare. I guess the basic problem here is that Emacs calculates window-height in integral equally sized line numbers. But less fundamentally and more directly, this problem arises, AFAICT, because dired-pop-to-buffer's shrink-to-fit code fails to account for header lines. To fix this it would suffice to add this sexp above the last sexp in dired-pop-to-buffer: (with-current-buffer buf (and header-line-format (progn (select-window w2) (enlarge-window 1)))) However, unless I'm missing something, fit-window-to-buffer does what dired-pop-to-buffer's shrink-to-fit code does, and moreover also handles header lines. From perusing the change logs, I found several instances where fit-window-to-buffer replaces library-specific code, and this appears to be another candidate (dired-pop-to-buffer was introduced many years before fit-window-to-buffer), in addition to fixing the above bug. I'm not able to fix the display code to let window-height return fractional line numbers, so I propose the following patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: dired-pop-to-buffer patch *** emacs/lisp/dired.el.~1.414.~ 2008-12-03 10:17:51.000000000 +0100 --- emacs/lisp/dired.el 2008-12-04 10:11:05.000000000 +0100 *************** *** 2678,2721 **** (defun dired-pop-to-buffer (buf) ;; Pop up buffer BUF. ;; If dired-shrink-to-fit is t, make its window fit its contents. ! (if (not dired-shrink-to-fit) ! (pop-to-buffer (get-buffer-create buf)) ! ;; let window shrink to fit: ! (let ((window (selected-window)) ! target-lines w2) ! (cond ;; if split-height-threshold is enabled, use the largest window ! ((and (> (window-height (setq w2 (get-largest-window))) ! split-height-threshold) ! (window-full-width-p w2)) ! (setq window w2)) ! ;; if the least-recently-used window is big enough, use it ! ((and (> (window-height (setq w2 (get-lru-window))) ! (* 2 window-min-height)) ! (window-full-width-p w2)) ! (setq window w2))) ! (save-excursion ! (set-buffer buf) ! (goto-char (point-max)) ! (skip-chars-backward "\n\r\t ") ! (setq target-lines (count-lines (point-min) (point))) ! ;; Don't forget to count the last line. ! (if (not (bolp)) ! (setq target-lines (1+ target-lines)))) ! (if (<= (window-height window) (* 2 window-min-height)) ! ;; At this point, every window on the frame is too small to split. ! (setq w2 (display-buffer buf)) ! (setq w2 (split-window window ! (max window-min-height ! (- (window-height window) ! (1+ (max window-min-height target-lines))))))) ! (set-window-buffer w2 buf) ! (if (< (1- (window-height w2)) target-lines) ! (progn ! (select-window w2) ! (enlarge-window (- target-lines (1- (window-height w2)))))) ! (set-window-start w2 1) ! ))) (defcustom dired-no-confirm nil "A list of symbols for commands Dired should not confirm. --- 2678,2687 ---- (defun dired-pop-to-buffer (buf) ;; Pop up buffer BUF. + (pop-to-buffer (get-buffer-create buf)) ;; If dired-shrink-to-fit is t, make its window fit its contents. ! (when dired-shrink-to-fit ! (fit-window-to-buffer (get-buffer-window buf)))) (defcustom dired-no-confirm nil "A list of symbols for commands Dired should not confirm. --=-=-= (Note that if the frame is shrunk so that not all marked file names fit in the *Marked Files* window, then without an oversized header line as is my-mm, dired-pop-to-buffer fails with the error "Attempt to delete minibuffer or sole ordinary window"; whereas with an oversized header line, this error is raised only if not even one file name can be shown. But I see this difference in behavior whether or not the above patch is applied.) Steve Berman --=-=-=-- ------------=_1228989905-22284-0 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.0000 Tokens: new, 37; hammy, 38; neutral, 36; spammy, 0. spammytokens: hammytokens:0.000-+--23060, 0.000-+--23.0.60, 0.000-+--UD:el, 0.000-+--HX-Spam-Relays-External:213.165.64.20, 0.000-+--H*RU:mail.gmx.net X-Spam-Status: No, score=-6.7 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1488-done) by emacsbugs.donarmstrong.com; 11 Dec 2008 09:59:36 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id mBB9xWg6020342 for <1488-done@emacsbugs.donarmstrong.com>; Thu, 11 Dec 2008 01:59:34 -0800 Received: (qmail invoked by alias); 11 Dec 2008 09:59:26 -0000 Received: from 62-47-37-228.adsl.highway.telekom.at (EHLO [62.47.37.228]) [62.47.37.228] by mail.gmx.net (mp066) with SMTP; 11 Dec 2008 10:59:26 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX184pzJb9Tw4q2xAi9KJGqe//HoaZFEarTKvm0Q18a VCDydzmX+Ig0AD Message-ID: <4940E3E8.8050501@gmx.at> Date: Thu, 11 Dec 2008 10:56:56 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: 1488-done@emacsbugs.donarmstrong.com Subject: Re: bug#1488: 23.0.60; dired-pop-to-buffer: use fit-window-to-buffer References: <87fxl446mr.fsf@escher.local.home> In-Reply-To: <87fxl446mr.fsf@escher.local.home> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.76 Fixed as 2008-12-11 Stephen Berman * dired.el (dired-pop-to-buffer): Use fit-window-to-buffer when dired-shrink-to-fit is non-nil. (Bug#1488) Thanks, martin. ------------=_1228989905-22284-0--