aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2012-07-18 12:02:54 +0200
committerTassilo Horn2012-07-18 12:02:54 +0200
commit2dc2a609c584168036fae5196033ffca2a619a9e (patch)
treed25016854ad6625f4de058319e9d528630ca137d
parent169925ec990b7e22f35eb1e2c25a1b53f49072ff (diff)
downloademacs-2dc2a609c584168036fae5196033ffca2a619a9e.tar.gz
emacs-2dc2a609c584168036fae5196033ffca2a619a9e.zip
* window.el (split-window-sensibly): Make WINDOW argument
optional.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/window.el38
2 files changed, 25 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b1455a7816a..d1db5fa3a6b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-07-18 Tassilo Horn <tassilo@member.fsf.org>
2
3 * window.el (split-window-sensibly): Make WINDOW argument
4 optional.
5
12012-07-18 Chong Yidong <cyd@gnu.org> 62012-07-18 Chong Yidong <cyd@gnu.org>
2 7
3 * isearch.el (isearch-mode-map): Handle C-x 8 key translations, 8 * isearch.el (isearch-mode-map): Handle C-x 8 key translations,
diff --git a/lisp/window.el b/lisp/window.el
index f9adf84fc58..d58fa81a8de 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4475,8 +4475,9 @@ hold:
4475 (* 2 (max window-min-height 4475 (* 2 (max window-min-height
4476 (if mode-line-format 2 1)))))))))) 4476 (if mode-line-format 2 1))))))))))
4477 4477
4478(defun split-window-sensibly (window) 4478(defun split-window-sensibly (&optional window)
4479 "Split WINDOW in a way suitable for `display-buffer'. 4479 "Split WINDOW in a way suitable for `display-buffer'.
4480WINDOW defaults to the currently selected window.
4480If `split-height-threshold' specifies an integer, WINDOW is at 4481If `split-height-threshold' specifies an integer, WINDOW is at
4481least `split-height-threshold' lines tall and can be split 4482least `split-height-threshold' lines tall and can be split
4482vertically, split WINDOW into two windows one above the other and 4483vertically, split WINDOW into two windows one above the other and
@@ -4506,23 +4507,24 @@ more likely to occur.
4506Have a look at the function `window-splittable-p' if you want to 4507Have a look at the function `window-splittable-p' if you want to
4507know how `split-window-sensibly' determines whether WINDOW can be 4508know how `split-window-sensibly' determines whether WINDOW can be
4508split." 4509split."
4509 (or (and (window-splittable-p window) 4510 (let ((window (or window (selected-window))))
4510 ;; Split window vertically. 4511 (or (and (window-splittable-p window)
4511 (with-selected-window window 4512 ;; Split window vertically.
4512 (split-window-below))) 4513 (with-selected-window window
4513 (and (window-splittable-p window t) 4514 (split-window-below)))
4514 ;; Split window horizontally. 4515 (and (window-splittable-p window t)
4515 (with-selected-window window 4516 ;; Split window horizontally.
4516 (split-window-right))) 4517 (with-selected-window window
4517 (and (eq window (frame-root-window (window-frame window))) 4518 (split-window-right)))
4518 (not (window-minibuffer-p window)) 4519 (and (eq window (frame-root-window (window-frame window)))
4519 ;; If WINDOW is the only window on its frame and is not the 4520 (not (window-minibuffer-p window))
4520 ;; minibuffer window, try to split it vertically disregarding 4521 ;; If WINDOW is the only window on its frame and is not the
4521 ;; the value of `split-height-threshold'. 4522 ;; minibuffer window, try to split it vertically disregarding
4522 (let ((split-height-threshold 0)) 4523 ;; the value of `split-height-threshold'.
4523 (when (window-splittable-p window) 4524 (let ((split-height-threshold 0))
4524 (with-selected-window window 4525 (when (window-splittable-p window)
4525 (split-window-below))))))) 4526 (with-selected-window window
4527 (split-window-below))))))))
4526 4528
4527(defun window--try-to-split-window (window) 4529(defun window--try-to-split-window (window)
4528 "Try to split WINDOW. 4530 "Try to split WINDOW.