如何强制组织模式的捕获缓冲区在新窗口中打开?我试过了
(setq special-display-regexps
'("^\\*Capture\\*$"))
Run Code Online (Sandbox Code Playgroud)
但它不起作用 - 我暂时看到一个新窗口然后org-mode进行两次垂直分割(我使用3个垂直分割),并将捕获缓冲区放入正确的分割中.当我被要么完成了C-c C-c或者C-c C-k,原来分裂的设置被恢复.
我也喜欢使用许多并排分割(通常是4 - 我分布在多个显示器上),所以org-capture将4个常规窗口变成2个非常宽的窗口的行为让我每次都爆炸 -这往往会让我失去理智.
+---+---+---+---+ +-------+-------+
| 1 | 2 | 3 | 4 | --> | 1 |capture| = head explosion
+---+---+---+---+ +-------+-------+
Run Code Online (Sandbox Code Playgroud)
所以这是一种防止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))
Run Code Online (Sandbox Code Playgroud)
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))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1633 次 |
| 最近记录: |