如何强制组织模式的捕获缓冲区在新窗口中打开?我试过了
(setq special-display-regexps
'("^\\*Capture\\*$"))
但它不起作用 - 我暂时看到一个新窗口然后org-mode进行两次垂直分割(我使用3次垂直分割),并将捕获缓冲区放入右侧分割。当我完成C-c C-c
或C-c C-k
时,将恢复原始拆分设置。
答案 0 :(得分:5)
我也喜欢使用许多并排分割(通常是4 - 我分布在多个监视器上),所以org-capture
将4个常规窗口变成2个非常宽的窗口的行为每次都让我的头发爆炸 - 这往往会让我失去理智。
+---+---+---+---+ +-------+-------+
| 1 | 2 | 3 | 4 | --> | 1 |capture| = head explosion
+---+---+---+---+ +-------+-------+
因此,这是一种阻止org-capture
修改窗口配置的方法。
经过一些搜索,看起来并不像是有一种简单的方法来定制这种行为(或者至少不是一种明显的行为)。跟踪源代码中的函数调用将我们带到org-capture-place-template
,这将保存您的原始窗口配置,然后删除其他窗口,然后为您提供双窗口拆分。当然,当你最终确定捕获时,你会得到你的窗口配置,但是当你放弃那个“让我们改变你的窗口布局而没有说出来”的步骤时,你肯定会很高兴。
原来这很简单。在评论出调用org-capture-place-template
的单行后,只需重新评估(delete-other-windows)
:
(defun org-capture-place-template ()
"Insert the template at the target location, and display the buffer."
(org-capture-put :return-to-wconf (current-window-configuration))
;; (delete-other-windows) ; this is the culprit!
(org-switch-to-buffer-other-window
(org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
(widen)
(show-all)
(goto-char (org-capture-get :pos))
(org-set-local 'org-capture-target-marker
(point-marker))
(org-set-local 'outline-level 'org-outline-level)
(let* ((template (org-capture-get :template))
(type (org-capture-get :type)))
(case type
((nil entry) (org-capture-place-entry))
(table-line (org-capture-place-table-line))
(plain (org-capture-place-plain-text))
(item (org-capture-place-item))
(checkitem (org-capture-place-item))))
(org-capture-mode 1)
(org-set-local 'org-capture-current-plist org-capture-plist))
AAAAH。就像org-capture
每次使用它时都在打我的脸,但现在已经停止了。
(已编辑:以下内容适用于较新版本的org-mode)
(defun org-capture-place-template (&optional inhibit-wconf-store)
"Insert the template at the target location, and display the buffer.
When `inhibit-wconf-store', don't store the window configuration, as it
may have been stored before."
(unless inhibit-wconf-store
(org-capture-put :return-to-wconf (current-window-configuration)))
;(delete-other-windows)
(org-switch-to-buffer-other-window
(org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
(widen)
(show-all)
(goto-char (org-capture-get :pos))
(org-set-local 'org-capture-target-marker
(point-marker))
(org-set-local 'outline-level 'org-outline-level)
(let* ((template (org-capture-get :template))
(type (org-capture-get :type)))
(case type
((nil entry) (org-capture-place-entry))
(table-line (org-capture-place-table-line))
(plain (org-capture-place-plain-text))
(item (org-capture-place-item))
(checkitem (org-capture-place-item))))
(org-capture-mode 1)
(org-set-local 'org-capture-current-plist org-capture-plist))