Interactively enter headline under which to place an entry using capture

前端 未结 4 1271
被撕碎了的回忆
被撕碎了的回忆 2021-01-05 00:29

Using capture templates like the one below, I can add entries to different headlines in a file. How can I manually enter a headline during capture, instead of setting up eac

4条回答
  •  没有蜡笔的小新
    2021-01-05 00:54

    It looks like, in newer versions of org at least, that custom functions can be used in capture templates to do this.

    Instead of:

    entry
    (file+headline "~/Work/work.org" "Refile")
    

    You can use:

    entry
    (file+function "~/Work/work.org" function-finding-location)
    

    Where 'function-finding-location' is a custom function you have written yourself, which could easily prompt you for a headline.

    Or, you can go even farther, and define a custom function which will prompt for both file name and headline name (or anything else you can dream up):

    entry
    (function function-finding-location)
    

    I don't really know enough elisp to write these functions myself, but this looks like the place to start. It'd be nice if someone else could offer up some code. The relevant documentation is here:

    http://orgmode.org/manual/Template-elements.html

提交回复
热议问题