aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2014-08-21 10:40:29 +0200
committerMartin Rudalics2014-08-21 10:40:29 +0200
commitb360b106e9954a1f31bb4a22f023820958eafe5a (patch)
tree2b8578c20f371eb31d980444ae4464074c367564
parent8dc52a1a455bf3f7779abccddc5bef8af2415b10 (diff)
downloademacs-b360b106e9954a1f31bb4a22f023820958eafe5a.tar.gz
emacs-b360b106e9954a1f31bb4a22f023820958eafe5a.zip
Handle failed attempts to split a side window (Bug#18304).
* window.el (window--side-window-p): New function. (split-window, window-splittable-p): Use window--side-window-p to determine whether WINDOW can be split (Bug#18304). * calendar/calendar.el (calendar-basic-setup): Fix one call of `window-splittable-p' and add another (Bug#18304).
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/calendar/calendar.el8
-rw-r--r--lisp/window.el18
3 files changed, 26 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 115497c7e41..5ac028e91da 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
12014-08-21 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (window--side-window-p): New function.
4 (split-window, window-splittable-p): Use window--side-window-p to
5 determine whether WINDOW can be split (Bug#18304).
6 * calendar/calendar.el (calendar-basic-setup): Fix one call of
7 `window-splittable-p' and add another (Bug#18304).
8
12014-08-20 Sam Steingold <sds@gnu.org> 92014-08-20 Sam Steingold <sds@gnu.org>
2 10
3 * progmodes/python.el (python-new-pythonpath): Extract from 11 * progmodes/python.el (python-new-pythonpath): Extract from
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 581dd3437d9..7579f07cb2d 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1423,10 +1423,16 @@ display the generated calendar."
1423 ;; the right thing in that case. 1423 ;; the right thing in that case.
1424 ;; 1424 ;;
1425 ;; Is this a wide frame? If so, split it horizontally. 1425 ;; Is this a wide frame? If so, split it horizontally.
1426 (if (window-splittable-p t) (split-window-right)) 1426
1427 ;; The following doesn't sound useful: If we split horizontally
1428 ;; here, the subsequent `pop-to-buffer' will likely split again
1429 ;; horizontally and we end up with three side-by-side windows.
1430 (when (window-splittable-p (selected-window) t)
1431 (split-window-right))
1427 (pop-to-buffer calendar-buffer) 1432 (pop-to-buffer calendar-buffer)
1428 ;; Has the window already been split vertically? 1433 ;; Has the window already been split vertically?
1429 (when (and (not (window-dedicated-p)) 1434 (when (and (not (window-dedicated-p))
1435 (window-splittable-p (selected-window))
1430 (window-full-height-p)) 1436 (window-full-height-p))
1431 (let ((win (split-window-below))) 1437 (let ((win (split-window-below)))
1432 ;; In the upper window, show whatever was visible before. 1438 ;; In the upper window, show whatever was visible before.
diff --git a/lisp/window.el b/lisp/window.el
index a05dddeac9e..e159bd967f1 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -743,6 +743,15 @@ number of slots on that side."
743 (integer :tag "Number" :value 3 :size 5))) 743 (integer :tag "Number" :value 3 :size 5)))
744 :group 'windows) 744 :group 'windows)
745 745
746(defun window--side-window-p (window)
747 "Return non-nil if WINDOW is a side window or the parent of one."
748 (or (window-parameter window 'window-side)
749 (and (window-child window)
750 (or (window-parameter
751 (window-child window) 'window-side)
752 (window-parameter
753 (window-last-child window) 'window-side)))))
754
746(defun window--major-non-side-window (&optional frame) 755(defun window--major-non-side-window (&optional frame)
747 "Return the major non-side window of frame FRAME. 756 "Return the major non-side window of frame FRAME.
748The optional argument FRAME must be a live frame and defaults to 757The optional argument FRAME must be a live frame and defaults to
@@ -4378,12 +4387,7 @@ frame. The selected window is not changed by this function."
4378 ;; side window, throw an error unless `window-combination-resize' 4387 ;; side window, throw an error unless `window-combination-resize'
4379 ;; equals 'side. 4388 ;; equals 'side.
4380 ((and (not (eq window-combination-resize 'side)) 4389 ((and (not (eq window-combination-resize 'side))
4381 (or (window-parameter window 'window-side) 4390 (window--side-window-p window))
4382 (and (window-child window)
4383 (or (window-parameter
4384 (window-child window) 'window-side)
4385 (window-parameter
4386 (window-last-child window) 'window-side)))))
4387 (error "Cannot split side window or parent of side window")) 4391 (error "Cannot split side window or parent of side window"))
4388 ;; If `window-combination-resize' is 'side and window has a side 4392 ;; If `window-combination-resize' is 'side and window has a side
4389 ;; window sibling, bind `window-combination-limit' to t. 4393 ;; window sibling, bind `window-combination-limit' to t.
@@ -5798,7 +5802,7 @@ hold:
5798 wide as `split-width-threshold'. 5802 wide as `split-width-threshold'.
5799- When WINDOW is split evenly, the emanating windows are at least 5803- When WINDOW is split evenly, the emanating windows are at least
5800 `window-min-width' or two (whichever is larger) columns wide." 5804 `window-min-width' or two (whichever is larger) columns wide."
5801 (when (window-live-p window) 5805 (when (and (window-live-p window) (not (window--side-window-p window)))
5802 (with-current-buffer (window-buffer window) 5806 (with-current-buffer (window-buffer window)
5803 (if horizontal 5807 (if horizontal
5804 ;; A window can be split horizontally when its width is not 5808 ;; A window can be split horizontally when its width is not