1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-04 11:40:22 +00:00

(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.
This commit is contained in:
Richard M. Stallman 1994-09-22 20:00:48 +00:00
parent 889bf32987
commit cf1b1bf8c0

View File

@ -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 not the full width of the frame,
or if the window is the only window of its frame." or if the window is the only window of its frame."
(interactive) (interactive)
(or window (setq window (selected-window)))
(save-excursion (save-excursion
(set-buffer (window-buffer window)) (set-buffer (window-buffer window))
(let ((w (selected-window)) ;save-window-excursion can't win (let* ((w (selected-window)) ;save-window-excursion can't win
(buffer-file-name buffer-file-name) (buffer-file-name buffer-file-name)
(p (point)) (p (point))
(n 0) (n 0)
(ignore-final-newline (ignore-final-newline
;; If buffer ends with a newline, ignore it when counting height ;; If buffer ends with a newline, ignore it when counting height
;; unless point is after it. ;; unless point is after it.
(and (not (eobp)) (and (not (eobp))
(eq ?\n (char-after (1- (point-max)))))) (eq ?\n (char-after (1- (point-max))))))
(buffer-read-only nil) (buffer-read-only nil)
(modified (buffer-modified-p)) (modified (buffer-modified-p))
(buffer (current-buffer)) (buffer (current-buffer))
(mini (cdr (assq 'minibuffer (frame-parameters)))) (params (frame-parameters (window-frame window)))
(edges (window-edges (selected-window)))) (mini (cdr (assq 'minibuffer params)))
(if (and (< 1 (count-windows)) (edges (window-edges (selected-window))))
(= (window-width) (frame-width)) (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) (pos-visible-in-window-p (point-min) window)
(not (eq mini 'only)) (not (eq mini 'only))
(or (not mini) (or (not mini)
(< (nth 3 edges) (< (nth 3 edges)
(nth 1 (window-edges mini))) (nth 1 (window-edges mini)))
(> (nth 1 edges) (> (nth 1 edges)
(cdr (assq 'menu-bar-lines (frame-parameters)))))) (cdr (assq 'menu-bar-lines params)))))
(unwind-protect (unwind-protect
(progn (progn
(select-window (or window w)) (select-window (or window w))