Mercurial > hg > xemacs-beta
changeset 1127:68f6865bee47
[xemacs-hg @ 2002-11-28 12:38:16 by michaels]
2002-11-26 Mike Sperber <mike@xemacs.org>
* window.el (shrink-window-if-larger-than-buffer): Elide braindead
use of `save-window-excursion'.
author | michaels |
---|---|
date | Thu, 28 Nov 2002 12:38:17 +0000 |
parents | bcb5d65d0d94 |
children | 48359a7835c8 |
files | lisp/ChangeLog lisp/window.el |
diffstat | 2 files changed, 12 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Nov 28 12:34:44 2002 +0000 +++ b/lisp/ChangeLog Thu Nov 28 12:38:17 2002 +0000 @@ -1,3 +1,8 @@ +2002-11-26 Mike Sperber <mike@xemacs.org> + + * window.el (shrink-window-if-larger-than-buffer): Elide braindead + use of `save-window-excursion'. + 2002-11-28 Mike Sperber <mike@xemacs.org> * dialog.el (make-dialog-box): `set-frame-pixel-size' ->
--- a/lisp/window.el Thu Nov 28 12:34:44 2002 +0000 +++ b/lisp/window.el Thu Nov 28 12:38:17 2002 +0000 @@ -183,7 +183,6 @@ `(save-selected-window (select-window ,window) ,@body)) - (defun count-windows (&optional minibuf) "Return the number of visible windows. @@ -487,8 +486,7 @@ (or window (setq window (selected-window))) (save-excursion (set-buffer (window-buffer window)) - (let ((n 0) - (test-pos + (let ((test-pos (- (point-max) ;; If buffer ends with a newline, ignore it when counting ;; height unless point is after it. @@ -510,18 +508,12 @@ ;; The frame must not be minibuffer-only. (not (eq mini 'only))) (progn - (save-window-excursion - (goto-char (point-min)) - (while (and (window-live-p window) - (pos-visible-in-window-p test-pos window)) - (shrink-window 1 nil window) - (setq n (1+ n)))) - (if (> n 0) - (shrink-window (min (1- n) - (- (window-height window) - (1+ window-min-height))) - nil - window))))))) + (goto-char (point-min)) + (while (and (pos-visible-in-window-p test-pos window) + (> (window-height window) window-min-height)) + (shrink-window 1 nil window)) + (if (not (pos-visible-in-window-p test-pos window)) + (enlarge-window 1 nil window))))))) (defun kill-buffer-and-window () "Kill the current buffer and delete the selected window."