summaryrefslogtreecommitdiff
path: root/lisp/window.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-08-30 23:56:15 +0000
committerRichard M. Stallman <rms@gnu.org>1994-08-30 23:56:15 +0000
commit99409f1ec9b0540a17c85f83b3bbd13755b6f362 (patch)
treee30c1ddf011ff1eff3879c882732375b4be4c36b /lisp/window.el
parentd332bc27ff285cedff64125bff4fd994667d9fd3 (diff)
downloademacs-99409f1ec9b0540a17c85f83b3bbd13755b6f362.tar.gz
(shrink-window-if-larger-than-buffer):
Don't make the window shorter than window-min-height.
Diffstat (limited to 'lisp/window.el')
-rw-r--r--lisp/window.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 4ebe8b50e41..74edeb986da 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -145,6 +145,7 @@ No arg means split equally."
(defun shrink-window-if-larger-than-buffer (&optional window)
"Shrink the WINDOW to be as small as possible to display its contents.
+Do not shrink to less that `window-min-height' lines.
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 the window is not the full width of the frame,
@@ -161,7 +162,6 @@ or if the window is the only window of its frame."
;; unless point is after it.
(and (not (eobp))
(eq ?\n (char-after (1- (point-max))))))
- (window-min-height 0)
(buffer-read-only nil)
(modified (buffer-modified-p))
(buffer (current-buffer))
@@ -185,7 +185,10 @@ or if the window is the only window of its frame."
;; defeat file locking... don't try this at home, kids!
(setq buffer-file-name nil)
(insert ?\n) (setq n (1+ n)))
- (if (> n 0) (shrink-window (1- n))))
+ (if (> n 0)
+ (shrink-window (min (1- n)
+ (- (window-height)
+ window-min-height)))))
(delete-region (point-min) (point))
(set-buffer-modified-p modified)
(goto-char p)