Open Org Capture buffer in specific window?

回眸只為那壹抹淺笑 提交于 2019-12-08 01:28:46

问题


I've been an Emacs user for about a year or so. I routinely have the same window set up each session (four windows).

I've set up capture templates and can capture what I want, but: instead of capture mode temporarily jerking me out of my window setup, I'd like the chosen capture template to open in a new (fifth) window, preserving my existing layout. I typically want the capture template open for a while, so it's disruptive.

This seems like it would be an obvious option, but I can't figure it out. Thanks in advance to all the Emacs heads out there.


回答1:


I came up with a easier-to-use version of Dan's answer to the linked question:

(defun my-org-capture-place-template-dont-delete-windows (oldfun args)
  (cl-letf (((symbol-function 'delete-other-windows) 'ignore))
    (apply oldfun args)))

(with-eval-after-load "org-capture"
  (advice-add 'org-capture-place-template :around 'my-org-capture-place-template-dont-delete-windows))

That is, instead of having to modify Org-mode code and remove the call to delete-other-windows, this piece of code temporarily redefines delete-other-windows to ignore while org-capture-place-template is being called.

It doesn't do quite what you want: it picks one of the existing windows and puts the capture buffer there. At least it's better than the default behaviour of removing all previous windows but one.

There's probably a way to do what you want by customising the variable display-buffer-alist, but I couldn't figure it out...



来源:https://stackoverflow.com/questions/54192239/open-org-capture-buffer-in-specific-window

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!