emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109136: * window.el (split-window-se


From: Tassilo Horn
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109136: * window.el (split-window-sensibly): Make WINDOW argument
Date: Wed, 18 Jul 2012 12:02:54 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109136
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Wed 2012-07-18 12:02:54 +0200
message:
  * window.el (split-window-sensibly): Make WINDOW argument
  optional.
modified:
  lisp/ChangeLog
  lisp/window.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-18 09:27:23 +0000
+++ b/lisp/ChangeLog    2012-07-18 10:02:54 +0000
@@ -1,3 +1,8 @@
+2012-07-18  Tassilo Horn  <address@hidden>
+
+       * window.el (split-window-sensibly): Make WINDOW argument
+       optional.
+
 2012-07-18  Chong Yidong  <address@hidden>
 
        * isearch.el (isearch-mode-map): Handle C-x 8 key translations,

=== modified file 'lisp/window.el'
--- a/lisp/window.el    2012-07-06 06:22:56 +0000
+++ b/lisp/window.el    2012-07-18 10:02:54 +0000
@@ -4475,8 +4475,9 @@
                      (* 2 (max window-min-height
                                (if mode-line-format 2 1))))))))))
 
-(defun split-window-sensibly (window)
+(defun split-window-sensibly (&optional window)
   "Split WINDOW in a way suitable for `display-buffer'.
+WINDOW defaults to the currently selected window.
 If `split-height-threshold' specifies an integer, WINDOW is at
 least `split-height-threshold' lines tall and can be split
 vertically, split WINDOW into two windows one above the other and
@@ -4506,23 +4507,24 @@
 Have a look at the function `window-splittable-p' if you want to
 know how `split-window-sensibly' determines whether WINDOW can be
 split."
-  (or (and (window-splittable-p window)
-          ;; Split window vertically.
-          (with-selected-window window
-            (split-window-below)))
-      (and (window-splittable-p window t)
-          ;; Split window horizontally.
-          (with-selected-window window
-            (split-window-right)))
-      (and (eq window (frame-root-window (window-frame window)))
-          (not (window-minibuffer-p window))
-          ;; If WINDOW is the only window on its frame and is not the
-          ;; minibuffer window, try to split it vertically disregarding
-          ;; the value of `split-height-threshold'.
-          (let ((split-height-threshold 0))
-            (when (window-splittable-p window)
-              (with-selected-window window
-                (split-window-below)))))))
+  (let ((window (or window (selected-window))))
+    (or (and (window-splittable-p window)
+            ;; Split window vertically.
+            (with-selected-window window
+              (split-window-below)))
+       (and (window-splittable-p window t)
+            ;; Split window horizontally.
+            (with-selected-window window
+              (split-window-right)))
+       (and (eq window (frame-root-window (window-frame window)))
+            (not (window-minibuffer-p window))
+            ;; If WINDOW is the only window on its frame and is not the
+            ;; minibuffer window, try to split it vertically disregarding
+            ;; the value of `split-height-threshold'.
+            (let ((split-height-threshold 0))
+              (when (window-splittable-p window)
+                (with-selected-window window
+                  (split-window-below))))))))
 
 (defun window--try-to-split-window (window)
   "Try to split WINDOW.


reply via email to

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