diff options
| author | Tassilo Horn | 2012-07-18 12:02:54 +0200 |
|---|---|---|
| committer | Tassilo Horn | 2012-07-18 12:02:54 +0200 |
| commit | 2dc2a609c584168036fae5196033ffca2a619a9e (patch) | |
| tree | d25016854ad6625f4de058319e9d528630ca137d | |
| parent | 169925ec990b7e22f35eb1e2c25a1b53f49072ff (diff) | |
| download | emacs-2dc2a609c584168036fae5196033ffca2a619a9e.tar.gz emacs-2dc2a609c584168036fae5196033ffca2a619a9e.zip | |
* window.el (split-window-sensibly): Make WINDOW argument
optional.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/window.el | 38 |
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 @@ | |||
| 1 | 2012-07-18 Tassilo Horn <tassilo@member.fsf.org> | ||
| 2 | |||
| 3 | * window.el (split-window-sensibly): Make WINDOW argument | ||
| 4 | optional. | ||
| 5 | |||
| 1 | 2012-07-18 Chong Yidong <cyd@gnu.org> | 6 | 2012-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'. |
| 4480 | WINDOW defaults to the currently selected window. | ||
| 4480 | If `split-height-threshold' specifies an integer, WINDOW is at | 4481 | If `split-height-threshold' specifies an integer, WINDOW is at |
| 4481 | least `split-height-threshold' lines tall and can be split | 4482 | least `split-height-threshold' lines tall and can be split |
| 4482 | vertically, split WINDOW into two windows one above the other and | 4483 | vertically, split WINDOW into two windows one above the other and |
| @@ -4506,23 +4507,24 @@ more likely to occur. | |||
| 4506 | Have a look at the function `window-splittable-p' if you want to | 4507 | Have a look at the function `window-splittable-p' if you want to |
| 4507 | know how `split-window-sensibly' determines whether WINDOW can be | 4508 | know how `split-window-sensibly' determines whether WINDOW can be |
| 4508 | split." | 4509 | split." |
| 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. |