emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog calendar/calendar.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog calendar/calendar.el
Date: Sat, 03 Oct 2009 02:19:26 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/10/03 02:19:25

Modified files:
        lisp           : ChangeLog 
        lisp/calendar  : calendar.el 

Log message:
        (calendar-basic-setup): Handle the case where the frame is wide.
        (calendar-generate-window): Test for shrinkability rather than width.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16332&r2=1.16333
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/calendar/calendar.el?cvsroot=emacs&r1=1.285&r2=1.286

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16332
retrieving revision 1.16333
diff -u -b -r1.16332 -r1.16333
--- ChangeLog   3 Oct 2009 02:11:59 -0000       1.16332
+++ ChangeLog   3 Oct 2009 02:19:22 -0000       1.16333
@@ -1,5 +1,9 @@
 2009-10-03  Glenn Morris  <address@hidden>
 
+       * calendar/calendar.el (calendar-basic-setup): Handle the case where
+       the frame is wide.
+       (calendar-generate-window): Test for shrinkability rather than width.
+
        * cedet/semantic/db-find.el (data-debug-insert-tag-list): Comment out
        declaration, currently false.
 

Index: calendar/calendar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/calendar/calendar.el,v
retrieving revision 1.285
retrieving revision 1.286
diff -u -b -r1.285 -r1.286
--- calendar/calendar.el        22 Sep 2009 07:38:01 -0000      1.285
+++ calendar/calendar.el        3 Oct 2009 02:19:25 -0000       1.286
@@ -1283,6 +1283,8 @@
   (set-buffer (get-buffer-create calendar-buffer))
   (calendar-mode)
   (let* ((pop-up-windows t)
+         ;; Not really needed now, but means we use exactly the same
+         ;; behavior as before in the non-wide case (see below).
          (split-height-threshold 1000)
          (date (if arg (calendar-read-date t)
                  (calendar-current-date)))
@@ -1291,7 +1293,40 @@
     (calendar-increment-month month year (- calendar-offset))
     ;; Display the buffer before calling calendar-generate-window so that it
     ;; can get a chance to adjust the window sizes to the frame size.
-    (or nodisplay (pop-to-buffer calendar-buffer))
+    (unless nodisplay
+      ;; We want a window configuration that looks something like
+      ;; X        X | Y
+      ;; -        -----
+      ;; C        Z | C
+      ;; where C is the calendar, and the LHS is the traditional,
+      ;; non-wide frame, and the RHS is the wide frame case.
+      ;; We should end up in the same state regardless of whether the
+      ;; windows were initially split or not.
+      ;; Previously, we only thought about the non-wide case.
+      ;; We could just set split-height-threshold to 1000, relying on
+      ;; the fact that the window splitting treated a single window as
+      ;; a special case and would always split it (vertically).  The
+      ;; same thing does not work in the wide-frame case, so now we do
+      ;; the splitting by hand.
+      ;; See discussion in bug#1806.
+      ;; Actually, this still does not do quite the right thing in the
+      ;; wide frame case if started from a configuration like the LHS.
+      ;; Eg if you start with a non-wide frame, call calendar, then
+      ;; make the frame wider.  This one is problematic because you
+      ;; might need to split a totally unrelated window.  Oh well, it
+      ;; seems unlikely, and perhaps respecting the original layout is
+      ;; the right thing in that case.
+      ;;
+      ;; Is this a wide frame?  If so, split it horizontally.
+      (if (window-splittable-p t) (split-window-horizontally))
+      (pop-to-buffer calendar-buffer)
+      ;; Has the window already been split vertically?  (See bug#4543)
+      (when (= (window-height) (window-height (frame-root-window)))
+        (let ((win (split-window-vertically)))
+          ;; Show something else in the upper window.
+          (switch-to-buffer (other-buffer))
+          ;; Switch to the lower window with the calendar buffer.
+          (select-window win))))
     (calendar-generate-window month year)
     (if (and calendar-view-diary-initially-flag
              (calendar-date-is-visible-p date))
@@ -1325,7 +1360,12 @@
     ;; Don't do any window-related stuff if we weren't called from a
     ;; window displaying the calendar.
     (when in-calendar-window
-      (if (or (one-window-p t) (not (window-full-width-p)))
+      ;; 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)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]