How do I force org-mode's capture buffer to open in a new window? I tried
(setq special-display-regexps
'("^\\*Capture\\*$"))
but it did not work - I see a new window momentarily and then org-mode makes two vertical splits (I'm using 3 vertical splits), and put the capture buffer into the right split. When I'm done by either C-c C-c
or C-c C-k
, the original split setting is restored.
Here's the solution I came up with. This causes the entire capture process to occur in a single pop-out frame.
First, a couple of helper functions.
Next, a macro to install temporary advice. If you prefer, you could inline this pretty easily.
Here's the main function. The idea is to temporarily override everything that Org-mode is doing that we don't want. This includes the
delete-other-windows
call mentioned in Dan's answer, and also two calls toorg-switch-to-buffer-other-window
, which explicitly blocks pop-out frames.To get rid of the frame after capture is complete, use this function:
This is already called by
my/capture-in-popout-frame
in the event of an early abort (e.g., typingq
in the template selection buffer orC-g
in response to a prompt in a capture template). For normal completion (including refiling) or a late abort (C-c C-k
from the capture template), you need to add it toorg-capture-after-finalize-hook
.Note that none of these functions modify the way independent calls to
org-capture
work (unless for some reason you have an extra frame named "Capture" lying around), so you can still get the default behavior if you want it for a particular capture.One caveat: This won't support multiple simultaneous capture processes. I don't have a need for that personally, but if you do, I don't think it should be too hard to add that capability.
I, too, like to use many side-by-side splits (usually 4 -- I'm spread across multiple monitors), so
org-capture
's behavior of turning 4 regular windows into 2 really wide ones makes my head explode every time -- which tends to knock me out of my flow.So here's a way to prevent
org-capture
from modifying your window configuration.After some searching, it does not look like there is an easy way to customize this behavior (or at least not an obvious one). Tracing the function calls in the source code brings us to
org-capture-place-template
, which saves your original window configuration, then deletes the other windows, then gives you the two-window split. You get your window configuration back later when you finalize the capture, of course, but it sure would be nice to get rid of that "let's change your window layout without your say-so" step.Turns out it's pretty simple. Just re-evaluate
org-capture-place-template
after commenting out the single line calling(delete-other-windows)
:Aaaah. It was like
org-capture
was punching me in the face every time I used it, but now it's stopped.(Edited: the following is for a newer version of org-mode)