Restore window-safely-shrinkable-p but avoid using it in calendar.el.
authorMartin Rudalics <rudalics@gmx.at>
Sun, 12 Jun 2011 07:46:56 +0000 (09:46 +0200)
committerMartin Rudalics <rudalics@gmx.at>
Sun, 12 Jun 2011 07:46:56 +0000 (09:46 +0200)
* 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
lisp/calendar/calendar.el
lisp/window.el

index c146556..a72f2a8 100644 (file)
@@ -1,3 +1,13 @@
+2011-06-12  Martin Rudalics  <rudalics@gmx.at>
+
+       * 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  <rgm@gnu.org>
 
        * progmodes/fortran.el (fortran-mode-syntax-table):
index fa19d1f..2c38101 100644 (file)
@@ -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))
index ace8282..94ac914 100644 (file)
@@ -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