emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117719: Handle failed attempts to split a side wind


From: Martin Rudalics
Subject: [Emacs-diffs] trunk r117719: Handle failed attempts to split a side window (Bug#18304).
Date: Thu, 21 Aug 2014 08:40:53 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117719
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Thu 2014-08-21 10:40:29 +0200
message:
  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).
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/calendar/calendar.el      calendar.el-20091113204419-o5vbwnq5f7feedwu-478
  lisp/window.el                 window.el-20091113204419-o5vbwnq5f7feedwu-94
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-08-20 20:07:00 +0000
+++ b/lisp/ChangeLog    2014-08-21 08:40:29 +0000
@@ -1,3 +1,11 @@
+2014-08-21  Martin Rudalics  <address@hidden>
+
+       * 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).
+
 2014-08-20  Sam Steingold  <address@hidden>
 
        * progmodes/python.el (python-new-pythonpath): Extract from

=== modified file 'lisp/calendar/calendar.el'
--- a/lisp/calendar/calendar.el 2014-06-13 19:37:52 +0000
+++ b/lisp/calendar/calendar.el 2014-08-21 08:40:29 +0000
@@ -1423,10 +1423,16 @@
         ;; the right thing in that case.
         ;;
         ;; Is this a wide frame?  If so, split it horizontally.
-        (if (window-splittable-p t) (split-window-right))
+
+       ;; The following doesn't sound useful: If we split horizontally
+       ;; here, the subsequent `pop-to-buffer' will likely split again
+       ;; horizontally and we end up with three side-by-side windows.
+        (when (window-splittable-p (selected-window) t)
+         (split-window-right))
         (pop-to-buffer calendar-buffer)
         ;; Has the window already been split vertically?
         (when (and (not (window-dedicated-p))
+                  (window-splittable-p (selected-window))
                    (window-full-height-p))
           (let ((win (split-window-below)))
             ;; In the upper window, show whatever was visible before.

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2014-08-11 00:59:34 +0000
+++ b/lisp/window.el    2014-08-21 08:40:29 +0000
@@ -743,6 +743,15 @@
      (integer :tag "Number" :value 3 :size 5)))
   :group 'windows)
 
+(defun window--side-window-p (window)
+  "Return non-nil if WINDOW is a side window or the parent of one."
+  (or (window-parameter window 'window-side)
+      (and (window-child window)
+          (or (window-parameter
+               (window-child window) 'window-side)
+              (window-parameter
+               (window-last-child window) 'window-side)))))
+
 (defun window--major-non-side-window (&optional frame)
   "Return the major non-side window of frame FRAME.
 The optional argument FRAME must be a live frame and defaults to
@@ -4378,12 +4387,7 @@
        ;; side window, throw an error unless `window-combination-resize'
        ;; equals 'side.
        ((and (not (eq window-combination-resize 'side))
-            (or (window-parameter window 'window-side)
-                (and (window-child window)
-                     (or (window-parameter
-                          (window-child window) 'window-side)
-                         (window-parameter
-                          (window-last-child window) 'window-side)))))
+            (window--side-window-p window))
        (error "Cannot split side window or parent of side window"))
        ;; If `window-combination-resize' is 'side and window has a side
        ;; window sibling, bind `window-combination-limit' to t.
@@ -5798,7 +5802,7 @@
   wide as `split-width-threshold'.
 - When WINDOW is split evenly, the emanating windows are at least
   `window-min-width' or two (whichever is larger) columns wide."
-  (when (window-live-p window)
+  (when (and (window-live-p window) (not (window--side-window-p window)))
     (with-current-buffer (window-buffer window)
       (if horizontal
          ;; A window can be split horizontally when its width is not


reply via email to

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