From 39cffb4422b22282a32a29946b3e038f32ce90b5 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Sun, 12 Jun 2011 09:46:56 +0200 Subject: [PATCH] Restore window-safely-shrinkable-p but avoid using it in calendar.el. * window.el (window-safely-shrinkable-p): Restore function which was inadvertently removed in change from 2011-06-11. Declare as obsolete. * calendar/calendar.el (calendar-generate-window): Use window-iso-combined-p instead of combination of one-window-p and window-safely-shrinkable-p. --- lisp/ChangeLog | 10 ++++++++++ lisp/calendar/calendar.el | 17 ++++++----------- lisp/window.el | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c14655699e7..a72f2a89d99 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,13 @@ +2011-06-12 Martin Rudalics + + * window.el (window-safely-shrinkable-p): Restore function which + was inadvertently removed in change from 2011-06-11. Declare as + obsolete. + + * calendar/calendar.el (calendar-generate-window): Use + window-iso-combined-p instead of combination of one-window-p and + window-safely-shrinkable-p. + 2011-06-12 Glenn Morris * progmodes/fortran.el (fortran-mode-syntax-table): diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index fa19d1ffe14..2c38101588c 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1373,17 +1373,12 @@ Optional integers MON and YR are used instead of today's date." ;; Don't do any window-related stuff if we weren't called from a ;; window displaying the calendar. (when in-calendar-window - ;; The second test used to be window-full-width-p. - ;; Not sure what it was/is for, except perhaps some way of saying - ;; "try not to mess with existing configurations". - ;; If did the wrong thing on wide frames, where we have done a - ;; horizontal split in calendar-basic-setup. - (if (or (one-window-p t) (not (window-safely-shrinkable-p))) - ;; Don't mess with the window size, but ensure that the first - ;; line is fully visible. - (set-window-vscroll nil 0) - ;; Adjust the window to exactly fit the displayed calendar. - (fit-window-to-buffer nil nil calendar-minimum-window-height)) + (if (window-iso-combined-p) + ;; Adjust the window to exactly fit the displayed calendar. + (fit-window-to-buffer nil nil calendar-minimum-window-height) + ;; For a full height window or a window that is horizontally + ;; combined don't fit height to that of its buffer. + (set-window-vscroll nil 0)) (sit-for 0)) (and (bound-and-true-p font-lock-mode) (font-lock-fontify-buffer)) diff --git a/lisp/window.el b/lisp/window.el index ace82826e67..94ac9143efd 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4481,6 +4481,20 @@ WINDOW was scrolled." (error (setq delta nil))) delta)))) +(defun window-safely-shrinkable-p (&optional window) + "Return t if WINDOW can be shrunk without shrinking other windows. +WINDOW defaults to the selected window." + (with-selected-window (or window (selected-window)) + (let ((edges (window-edges))) + ;; The following doesn't satisfy the doc-string's claim when + ;; window and previous-/next-window are not part of the same + ;; combination but still share a common edge. Using + ;; `window-iso-combined-p' instead should handle that. + (or (= (nth 2 edges) (nth 2 (window-edges (previous-window)))) + (= (nth 0 edges) (nth 0 (window-edges (next-window)))))))) +(make-obsolete + 'window-safely-shrinkable-p "use `window-iso-combined-p' instead." "24.1") + (defun shrink-window-if-larger-than-buffer (&optional window) "Shrink height of WINDOW if its buffer doesn't need so many lines. More precisely, shrink WINDOW vertically to be as small as -- 2.39.2