unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Drew Adams <drew.adams@oracle.com>, 3600@emacsbugs.donarmstrong.com
Subject: bug#3600: 23.0.94; shrink-window-if-larger-than-buffer
Date: Thu, 18 Jun 2009 12:07:35 +0200	[thread overview]
Message-ID: <4A3A11E7.4060900@gmx.at> (raw)
In-Reply-To: <0F4C735B7FF74432818F7CFAB4C85394@us.oracle.com>

[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

 > 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

[-- Attachment #2: window.el.diff --]
[-- Type: text/plain, Size: 1579 bytes --]

*** 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 ()

  reply	other threads:[~2009-06-18 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 19:44 bug#3600: 23.0.94; shrink-window-if-larger-than-buffer Drew Adams
2009-06-18 10:07 ` martin rudalics [this message]
2009-06-18 17:23   ` Drew Adams
2009-06-19  8:51     ` martin rudalics
2009-06-19 21:23       ` Drew Adams
2009-06-20  8:08         ` martin rudalics
2011-09-17  6:08         ` Lars Magne Ingebrigtsen
2011-09-17 14:06           ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A3A11E7.4060900@gmx.at \
    --to=rudalics@gmx.at \
    --cc=3600@emacsbugs.donarmstrong.com \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).