diff options
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calendar/calendar.el | 106 |
2 files changed, 59 insertions, 52 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a8306293cc4..387ddb72c9f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2009-10-07 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * calendar/calendar.el (calendar-basic-setup): In the wide frame case, | ||
| 4 | show the original buffer rather than a random one. | ||
| 5 | |||
| 1 | 2009-10-07 Markus Rost <rost@math.uni-bielefeld.de> | 6 | 2009-10-07 Markus Rost <rost@math.uni-bielefeld.de> |
| 2 | 7 | ||
| 3 | * help.el (describe-no-warranty): Place point in a slightly better | 8 | * help.el (describe-no-warranty): Place point in a slightly better |
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index c22c29ae1b5..ddccc529568 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el | |||
| @@ -1280,58 +1280,60 @@ If optional prefix argument ARG is non-nil, prompts for the month | |||
| 1280 | and year, else uses the current date. If NODISPLAY is non-nil, don't | 1280 | and year, else uses the current date. If NODISPLAY is non-nil, don't |
| 1281 | display the generated calendar." | 1281 | display the generated calendar." |
| 1282 | (interactive "P") | 1282 | (interactive "P") |
| 1283 | (set-buffer (get-buffer-create calendar-buffer)) | 1283 | (let ((buff (current-buffer))) |
| 1284 | (calendar-mode) | 1284 | (set-buffer (get-buffer-create calendar-buffer)) |
| 1285 | (let* ((pop-up-windows t) | 1285 | (calendar-mode) |
| 1286 | ;; Not really needed now, but means we use exactly the same | 1286 | (let* ((pop-up-windows t) |
| 1287 | ;; behavior as before in the non-wide case (see below). | 1287 | ;; Not really needed now, but means we use exactly the same |
| 1288 | (split-height-threshold 1000) | 1288 | ;; behavior as before in the non-wide case (see below). |
| 1289 | (date (if arg (calendar-read-date t) | 1289 | (split-height-threshold 1000) |
| 1290 | (calendar-current-date))) | 1290 | (date (if arg (calendar-read-date t) |
| 1291 | (month (calendar-extract-month date)) | 1291 | (calendar-current-date))) |
| 1292 | (year (calendar-extract-year date))) | 1292 | (month (calendar-extract-month date)) |
| 1293 | (calendar-increment-month month year (- calendar-offset)) | 1293 | (year (calendar-extract-year date))) |
| 1294 | ;; Display the buffer before calling calendar-generate-window so that it | 1294 | (calendar-increment-month month year (- calendar-offset)) |
| 1295 | ;; can get a chance to adjust the window sizes to the frame size. | 1295 | ;; Display the buffer before calling calendar-generate-window so that it |
| 1296 | (unless nodisplay | 1296 | ;; can get a chance to adjust the window sizes to the frame size. |
| 1297 | ;; We want a window configuration that looks something like | 1297 | (unless nodisplay |
| 1298 | ;; X X | Y | 1298 | ;; We want a window configuration that looks something like |
| 1299 | ;; - ----- | 1299 | ;; X X | Y |
| 1300 | ;; C Z | C | 1300 | ;; - ----- |
| 1301 | ;; where C is the calendar, and the LHS is the traditional, | 1301 | ;; C Z | C |
| 1302 | ;; non-wide frame, and the RHS is the wide frame case. | 1302 | ;; where C is the calendar, and the LHS is the traditional, |
| 1303 | ;; We should end up in the same state regardless of whether the | 1303 | ;; non-wide frame, and the RHS is the wide frame case. |
| 1304 | ;; windows were initially split or not. | 1304 | ;; We should end up in the same state regardless of whether the |
| 1305 | ;; Previously, we only thought about the non-wide case. | 1305 | ;; windows were initially split or not. |
| 1306 | ;; We could just set split-height-threshold to 1000, relying on | 1306 | ;; Previously, we only thought about the non-wide case. |
| 1307 | ;; the fact that the window splitting treated a single window as | 1307 | ;; We could just set split-height-threshold to 1000, relying on |
| 1308 | ;; a special case and would always split it (vertically). The | 1308 | ;; the fact that the window splitting treated a single window as |
| 1309 | ;; same thing does not work in the wide-frame case, so now we do | 1309 | ;; a special case and would always split it (vertically). The |
| 1310 | ;; the splitting by hand. | 1310 | ;; same thing does not work in the wide-frame case, so now we do |
| 1311 | ;; See discussion in bug#1806. | 1311 | ;; the splitting by hand. |
| 1312 | ;; Actually, this still does not do quite the right thing in the | 1312 | ;; See discussion in bug#1806. |
| 1313 | ;; wide frame case if started from a configuration like the LHS. | 1313 | ;; Actually, this still does not do quite the right thing in the |
| 1314 | ;; Eg if you start with a non-wide frame, call calendar, then | 1314 | ;; wide frame case if started from a configuration like the LHS. |
| 1315 | ;; make the frame wider. This one is problematic because you | 1315 | ;; Eg if you start with a non-wide frame, call calendar, then |
| 1316 | ;; might need to split a totally unrelated window. Oh well, it | 1316 | ;; make the frame wider. This one is problematic because you |
| 1317 | ;; seems unlikely, and perhaps respecting the original layout is | 1317 | ;; might need to split a totally unrelated window. Oh well, it |
| 1318 | ;; the right thing in that case. | 1318 | ;; seems unlikely, and perhaps respecting the original layout is |
| 1319 | ;; | 1319 | ;; the right thing in that case. |
| 1320 | ;; Is this a wide frame? If so, split it horizontally. | 1320 | ;; |
| 1321 | (if (window-splittable-p t) (split-window-horizontally)) | 1321 | ;; Is this a wide frame? If so, split it horizontally. |
| 1322 | (pop-to-buffer calendar-buffer) | 1322 | (if (window-splittable-p t) (split-window-horizontally)) |
| 1323 | ;; Has the window already been split vertically? | 1323 | (pop-to-buffer calendar-buffer) |
| 1324 | (when (and (not (window-dedicated-p)) | 1324 | ;; Has the window already been split vertically? |
| 1325 | (window-full-height-p)) | 1325 | (when (and (not (window-dedicated-p)) |
| 1326 | (let ((win (split-window-vertically))) | 1326 | (window-full-height-p)) |
| 1327 | ;; Show something else in the upper window. | 1327 | (let ((win (split-window-vertically))) |
| 1328 | (switch-to-buffer (other-buffer)) | 1328 | ;; In the upper window, show whatever was visible before. |
| 1329 | ;; Switch to the lower window with the calendar buffer. | 1329 | ;; This looks better than using other-buffer. |
| 1330 | (select-window win)))) | 1330 | (switch-to-buffer buff) |
| 1331 | (calendar-generate-window month year) | 1331 | ;; Switch to the lower window with the calendar buffer. |
| 1332 | (if (and calendar-view-diary-initially-flag | 1332 | (select-window win)))) |
| 1333 | (calendar-date-is-visible-p date)) | 1333 | (calendar-generate-window month year) |
| 1334 | (diary-view-entries))) | 1334 | (if (and calendar-view-diary-initially-flag |
| 1335 | (calendar-date-is-visible-p date)) | ||
| 1336 | (diary-view-entries)))) | ||
| 1335 | (if calendar-view-holidays-initially-flag | 1337 | (if calendar-view-holidays-initially-flag |
| 1336 | (let* ((diary-buffer (get-file-buffer diary-file)) | 1338 | (let* ((diary-buffer (get-file-buffer diary-file)) |
| 1337 | (diary-window (if diary-buffer (get-buffer-window diary-buffer))) | 1339 | (diary-window (if diary-buffer (get-buffer-window diary-buffer))) |