> Hi Orgsters,
>
> I'm working on a package that I'd like to be able to integrate with
> org-capture.  I have some structured data (a description, a time,
> possibly a URL...)  and want to call org-capture from a hook to allow
> the user to record this data in Org.  I want the user to be able to
> provide their own capture template to control the formatting, target
> location, etc.
>
> I have two questions about this:
>
> 1.  What's the right way to call `org-capture' in this case?  Should I
>     ask the user to define a template in their `org-capture-templates'
>     and then have a defcustom to store the keys which identify that
>     template, so I can say (org-capture nil KEYS)?  Or is there some
>     other way I should call into the capture machinery where I identify
>     the template directly...?
>
> 2.  I gather I should use I' to store my data in
>     `org-capture-plist' immediately before(?) calling org-capture.  Is
>     there any calling convention I need to respect here?  :default-time,
>     :initial and :annotation seem like the relevant properties for me,
>     but do I need e.g. to clear the value of `org-capture-plist' first,
>     or always include certain other properties?
>

I suggest you look at the code of "DOCT: Declarative Org Capture
Templates for Emacs" as well as the code of org-catch, if you already
haven't. doct does basically what you describe in 1: "ask the user to
define a template in their `org-capture-templates' and then have a
defcustom to store the keys which identify that template". Of course
there are a bunch of extra steps, but the general idea is the same.
doct will also give you some ideas on how to handle
`org-capture-plist'. But the more important question is what kind of
data are you trying to store in `org-capture-plist' and why?

Reply via email to