Q: how can I control where the org
todo keywords buffer appears?
Entering a todo
keyword with C-c C-t
(org-todo
) opens a new
buffer with the keyword options and then closes it again after I
select one. So far, so good. However, it takes over another
window to do so, which is less good, especially since it really
only needs to display a line or two with the keywords.
So, with the following layout, hitting C-c C-t
while in the left
window (some-org-buffer
) will open *Org todo*
in the right
window:
+---------------------+---------------------+
| | |
| | |
| | |
| | |
| some-org-buffer | some-other-buffer |
| | |
| | |
| | |
| | |
+---------------------+---------------------+
Instead, I would like to have a small window pop up as a vertical split, as below:
+---------------------+---------------------+
| | |
| | |
| some-org-buffer | some-other-buffer |
| | |
| | |
+---------------------+ |
| | |
| *Org todo* | |
| | |
+---------------------+---------------------+
Cribbing from
this answer, I wrote a
function to put in the display-buffer-alist
:
(defun org-todo-position (buffer alist)
(let ((win (car (cl-delete-if-not
(lambda (window)
(with-current-buffer (window-buffer window)
(memq major-mode
'(org-mode org-agenda-mode))))
(window-list)))))
(when win
(let ((new (split-window win -5 'below)))
(set-window-buffer new buffer)
new))))
(add-to-list 'display-buffer-alist
(list " \\*Org todo\\*" #'dan-org-todo-position))
However, that fails to work. Sigh. What have I done wrong with
the display-buffer-alist
? More to the point, how do I get my
todo
keyword buffer to pop up where I want it?
org-switch-to-buffer-other-window
to do what you want -- you can create a condition that does whatever you want. – lawlist Aug 17 '15 at 20:31org-switch-to-buffer-other-window
and a whole bunch of other uglyorg
innards. See answer for the ignominious "solution." – Dan♦ Aug 17 '15 at 20:38win
. Is there a reason you can't just use(selected-window)
here? – Aaron Harris Oct 6 '15 at 15:36