summaryrefslogtreecommitdiff
path: root/lisp/window.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-09-22 20:00:48 +0000
committerRichard M. Stallman <rms@gnu.org>1994-09-22 20:00:48 +0000
commit9d9ae06c9c40d8d69d06298b262d77db7a541d34 (patch)
tree99772c06d11b934a0327dfd4405e2cd843ec10f0 /lisp/window.el
parenta061ca452e16966e2d305949b03c13c780c6b7d7 (diff)
downloademacs-9d9ae06c9c40d8d69d06298b262d77db7a541d34.tar.gz
(shrink-window-if-larger-than-buffer): Use WINDOW's frame
for all actions that operate on a frame. Set WINDOW to selected window if it was nil.
Diffstat (limited to 'lisp/window.el')
-rw-r--r--lisp/window.el40
1 files changed, 23 insertions, 17 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 256dbcd43d4..eafded0572b 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -151,31 +151,37 @@ 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,
or if the window is the only window of its frame."
(interactive)
+ (or window (setq window (selected-window)))
(save-excursion
(set-buffer (window-buffer window))
- (let ((w (selected-window)) ;save-window-excursion can't win
- (buffer-file-name buffer-file-name)
- (p (point))
- (n 0)
- (ignore-final-newline
- ;; If buffer ends with a newline, ignore it when counting height
- ;; unless point is after it.
- (and (not (eobp))
- (eq ?\n (char-after (1- (point-max))))))
- (buffer-read-only nil)
- (modified (buffer-modified-p))
- (buffer (current-buffer))
- (mini (cdr (assq 'minibuffer (frame-parameters))))
- (edges (window-edges (selected-window))))
- (if (and (< 1 (count-windows))
- (= (window-width) (frame-width))
+ (let* ((w (selected-window)) ;save-window-excursion can't win
+ (buffer-file-name buffer-file-name)
+ (p (point))
+ (n 0)
+ (ignore-final-newline
+ ;; If buffer ends with a newline, ignore it when counting height
+ ;; unless point is after it.
+ (and (not (eobp))
+ (eq ?\n (char-after (1- (point-max))))))
+ (buffer-read-only nil)
+ (modified (buffer-modified-p))
+ (buffer (current-buffer))
+ (params (frame-parameters (window-frame window)))
+ (mini (cdr (assq 'minibuffer params)))
+ (edges (window-edges (selected-window))))
+ (if (and (< 1 (let ((frame (selected-frame)))
+ (select-frame (window-frame window))
+ (unwind-protect
+ (count-windows)
+ (select-frame frame))))
+ (= (window-width window) (frame-width (window-frame window)))
(pos-visible-in-window-p (point-min) window)
(not (eq mini 'only))
(or (not mini)
(< (nth 3 edges)
(nth 1 (window-edges mini)))
(> (nth 1 edges)
- (cdr (assq 'menu-bar-lines (frame-parameters))))))
+ (cdr (assq 'menu-bar-lines params)))))
(unwind-protect
(progn
(select-window (or window w))