GNU bug report logs - #3600
23.0.94; shrink-window-if-larger-than-buffer

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 17 Jun 2009 19:50:05 UTC

Severity: normal

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3600 in the body.
You can then email your comments to 3600 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3600; Package emacs. (Wed, 17 Jun 2009 19:50:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 17 Jun 2009 19:50:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: 23.0.94; shrink-window-if-larger-than-buffer
Date: Wed, 17 Jun 2009 12:44:07 -0700
Dunno if there is a bug here, beyond possibly improving the doc
string. In general, I have a question about the code.
 
The code imposes this as one of the conditions for fitting the window
to the buffer:
 
(or (not (frame-parameter frame 'minibuffer))
    (let ((mini-window (minibuffer-window frame)))
      (or (null mini-window)
          (not (eq frame (window-frame mini-window)))
               (< (nth 3 edges) (nth 1 (window-edges mini-window)))
               (> (nth 1 edges) (frame-parameter frame 'menu-bar-lines)))))
 
I don't understand the last condition (>). At the least, this
condition seems to be missing from the doc string:
 
"Do nothing if the buffer contains more lines than the present window
height, or if some of the window's contents are scrolled out of view,
or if shrinking this window would also shrink another window, or if
the window is the only window of its frame."
 
What is that last condition (>) for?  What is the relation between the
number of menu-bar-lines and the `Top' position of the window?
 
And doesn't this code raise an error if the `menu-bar-lines' parameter
is nil? Should it really be doing that?
 
 
 
In GNU Emacs 23.0.94.1 (i386-mingw-nt5.1.2600)
 of 2009-05-24 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3600; Package emacs. (Thu, 18 Jun 2009 10:15:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 18 Jun 2009 10:15:08 GMT) Full text and rfc822 format available.

Message #10 received at 3600 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>, 3600 <at> debbugs.gnu.org
Subject: Re: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Thu, 18 Jun 2009 12:07:35 +0200
[Message part 1 (text/plain, inline)]
> The code imposes this as one of the conditions for fitting the window
> to the buffer:
>
> (or (not (frame-parameter frame 'minibuffer))
>     (let ((mini-window (minibuffer-window frame)))
>       (or (null mini-window)
>           (not (eq frame (window-frame mini-window)))
>                (< (nth 3 edges) (nth 1 (window-edges mini-window)))
>                (> (nth 1 edges) (frame-parameter frame 'menu-bar-lines)))))
>
> I don't understand the last condition (>). At the least, this
> condition seems to be missing from the doc string:
>
> "Do nothing if the buffer contains more lines than the present window
> height, or if some of the window's contents are scrolled out of view,
> or if shrinking this window would also shrink another window, or if
> the window is the only window of its frame."
>
> What is that last condition (>) for?  What is the relation between the
> number of menu-bar-lines and the `Top' position of the window?

I guess it's a poor man's attempt to make sure that there's some other
window above or below the one to shrink.

> And doesn't this code raise an error if the `menu-bar-lines' parameter
> is nil? Should it really be doing that?

Looks like a bug.  Could you try the attached patch?  Since this code
hasn't been touched for quite some time we can't fix it for Emacs 23.1
though.

martin
[window.el.diff (text/plain, inline)]
*** window.el.~1.180.~	2009-05-07 11:10:52.000000000 +0200
--- window.el	2009-06-18 11:31:13.234375000 +0200
***************
*** 1520,1527 ****
    (when (null window)
      (setq window (selected-window)))
    (let* ((frame (window-frame window))
! 	 (mini (frame-parameter frame 'minibuffer))
! 	 (edges (window-edges window)))
      (if (and (not (eq window (frame-root-window frame)))
  	     (window-safely-shrinkable-p window)
  	     (pos-visible-in-window-p (point-min) window)
--- 1520,1526 ----
    (when (null window)
      (setq window (selected-window)))
    (let* ((frame (window-frame window))
! 	 (mini (frame-parameter frame 'minibuffer)))
      (if (and (not (eq window (frame-root-window frame)))
  	     (window-safely-shrinkable-p window)
  	     (pos-visible-in-window-p (point-min) window)
***************
*** 1530,1539 ****
  		 (let ((mini-window (minibuffer-window frame)))
  		   (or (null mini-window)
  		       (not (eq frame (window-frame mini-window)))
! 		       (< (nth 3 edges)
! 			  (nth 1 (window-edges mini-window)))
! 		       (> (nth 1 edges)
! 			  (frame-parameter frame 'menu-bar-lines))))))
  	(fit-window-to-buffer window (window-height window)))))
  
  (defun kill-buffer-and-window ()
--- 1529,1536 ----
  		 (let ((mini-window (minibuffer-window frame)))
  		   (or (null mini-window)
  		       (not (eq frame (window-frame mini-window)))
! 		       (/= (window-height window)
! 			   (window-height (frame-root-window frame)))))))
  	(fit-window-to-buffer window (window-height window)))))
  
  (defun kill-buffer-and-window ()

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3600; Package emacs. (Thu, 18 Jun 2009 17:25:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 18 Jun 2009 17:25:06 GMT) Full text and rfc822 format available.

Message #15 received at 3600 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>, <3600 <at> debbugs.gnu.org>
Subject: RE: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Thu, 18 Jun 2009 10:23:16 -0700
> I guess it's a poor man's attempt to make sure that there's some other
> window above or below the one to shrink.
> 
>  > And doesn't this code raise an error if the `menu-bar-lines'
>  > parameter is nil? Should it really be doing that?
> 
> Looks like a bug.  Could you try the attached patch?  Since this code
> hasn't been touched for quite some time we can't fix it for Emacs 23.1
> though.

I don't know how to try it. What recipe do you suggest?

I didn't try anything before; I was just perusing the code, and I wondered what
it was trying to do.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3600; Package emacs. (Fri, 19 Jun 2009 09:00:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 19 Jun 2009 09:00:06 GMT) Full text and rfc822 format available.

Message #20 received at 3600 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 3600 <at> debbugs.gnu.org
Subject: Re: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Fri, 19 Jun 2009 10:51:23 +0200
> I don't know how to try it. What recipe do you suggest?

Apply the patch and either remake emacs or put the code of the patched
`shrink-window-if-larger-than-buffer' into your .emacs and wait till it
starts barking.  And don't forget to tell me if it doesn't bark at you
for a couple of weeks.  Then we can install it.

> I didn't try anything before; I was just perusing the code, and I wondered what
> it was trying to do.

The only way to understand such code is by comparing the original code
with the present one and, if they differ, go through the revisions, look
at the ChangeLogs, and maybe scan emacs-devel and friends for errors
reported wrt that code.

martin



Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3600; Package emacs. (Fri, 19 Jun 2009 21:30:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 19 Jun 2009 21:30:04 GMT) Full text and rfc822 format available.

Message #25 received at 3600 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>
Cc: <3600 <at> debbugs.gnu.org>
Subject: RE: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Fri, 19 Jun 2009 14:23:36 -0700
>  > I don't know how to try it. What recipe do you suggest?
> 
> Apply the patch and either remake emacs or put the code of the patched
> `shrink-window-if-larger-than-buffer' into your .emacs and 
> wait till it starts barking.  And don't forget to tell me if it
> doesn't bark at you for a couple of weeks.  Then we can install it.

I think I'll pass. The affected part of the code is something that I will
probably never run into, let alone within a couple of weeks. The use case for
that code path is something that someone else will need to test, if it is tested
at all.

>  > I didn't try anything before; I was just perusing the 
>  > code, and I wondered what it was trying to do.
> 
> The only way to understand such code is by comparing the original code
> with the present one and, if they differ, go through the 
> revisions, look at the ChangeLogs, and maybe scan emacs-devel and
> friends for errors reported wrt that code.

I think you misunderstood me. I was speaking about perusing the original code,
not yours. I was saying that I didn't run into a problem trying to do something.
I didn't run into a problem at all. I was simply browsing the (original) code
and noticed that it seemed strange. That's all.

I have no problem with your fix. (And I personally have no problem if no fix is
applied.)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3600; Package emacs. (Sat, 20 Jun 2009 08:15:13 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sat, 20 Jun 2009 08:15:13 GMT) Full text and rfc822 format available.

Message #30 received at 3600 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 3600 <at> debbugs.gnu.org
Subject: Re: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Sat, 20 Jun 2009 10:08:25 +0200
>>  > I didn't try anything before; I was just perusing the
>>  > code, and I wondered what it was trying to do.
>>
>> The only way to understand such code is by comparing the original code
>> with the present one and, if they differ, go through the
>> revisions, look at the ChangeLogs, and maybe scan emacs-devel and
>> friends for errors reported wrt that code.
>
> I think you misunderstood me. I was speaking about perusing the original code,
> not yours. I was saying that I didn't run into a problem trying to do something.
> I didn't run into a problem at all. I was simply browsing the (original) code
> and noticed that it seemed strange. That's all.

What's your semantics of the word "peruse"?

martin




bug closed, send any further explanations to 3600 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 17 Sep 2011 06:18:01 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3600; Package emacs. (Sat, 17 Sep 2011 06:20:13 GMT) Full text and rfc822 format available.

Message #35 received at 3600 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'martin rudalics' <rudalics <at> gmx.at>, 3600 <at> debbugs.gnu.org
Subject: Re: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Sat, 17 Sep 2011 08:08:41 +0200
"Drew Adams" <drew.adams <at> oracle.com> writes:

> I think you misunderstood me. I was speaking about perusing the
> original code, not yours. I was saying that I didn't run into a
> problem trying to do something.  I didn't run into a problem at all. I
> was simply browsing the (original) code and noticed that it seemed
> strange. That's all.

This doesn't seem like a bug, so I'm closing the report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3600; Package emacs. (Sat, 17 Sep 2011 14:12:01 GMT) Full text and rfc822 format available.

Message #38 received at 3600 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Lars Magne Ingebrigtsen'" <larsi <at> gnus.org>
Cc: 'martin rudalics' <rudalics <at> gmx.at>, 3600 <at> debbugs.gnu.org
Subject: RE: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Sat, 17 Sep 2011 07:06:24 -0700
> This doesn't seem like a bug, so I'm closing the report.

Why?  Why does it not seem like a bug to you?  The Emacs windows expert (Martin)
said clearly "Looks like a bug.", and he provided a patch that tries to to fix
it.

I reported it, but I declined to build Emacs and test the proposed fix.  That
does not imply that there is no bug.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 16 Oct 2011 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 254 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.