Created
April 1, 2015 15:36
-
-
Save mpontus/3526f886c494a9e2b5b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun display-buffer-above-selected (buffer alist) | |
| "Try displaying BUFFER in a window below the selected window. | |
| This either splits the selected window or reuses the window below | |
| the selected one." | |
| (let (window) | |
| (or (and (setq window (window-in-direction 'above)) | |
| (eq buffer (window-buffer window)) | |
| (window--display-buffer buffer window 'reuse alist)) | |
| (and (not (frame-parameter nil 'unsplittable)) | |
| (let ((split-height-threshold 0) | |
| split-width-threshold) | |
| (setq window (selected-window)) | |
| (select-window (window--try-to-split-window window alist))) | |
| (window--display-buffer | |
| buffer window 'window alist display-buffer-mark-dedicated)) | |
| (and (setq window (window-in-direction 'above)) | |
| (not (window-dedicated-p window)) | |
| (window--display-buffer | |
| buffer window 'reuse alist display-buffer-mark-dedicated)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment