Ihor Radchenko <[email protected]> writes: > Richard Lawrence <[email protected]> writes: > >>> The most appropriate existing mechanism to pass metadata into capture >>> template is org-store-link-plist. That's what org-protocol uses. >>> %:keyword in capture templates uses org-store-link-plist.
> We already separate `org-capture-plist' > and `org-store-link-plist'. The latter is used to expand %:keyword > specifically. It is also populated automatically (an unconditionally) by > org-store-link. Allowing override for this link-based plist makes sense, > and it is already done by org-capture, just using slightly awkward > implementation (org-capture-link-is-already-stored). > ... >> My use case is recording appointment data that was written in an email, >> so it's important to be able to provide dates and times in addition to >> just strings. Ideally start *and* end times, either as dates or as Lisp >> timestamps, without having to worry about formatting them. It would >> also be useful to be able to provide values for properties that Org >> recognizes, like LOCATION or ID. > > What is interesting, some email support is already available in > `org-link-store-props' (read - for all links types). Via > `mail-extract-address-components': > > | Link type | Available keywords | > |--------------+----------------------------------------------------------| > ... > | mh, rmail | =%:type=, =%:subject=, =%:message-id= | > | | =%:from=, =%:fromname=, =%:fromaddress= | > | | =%:to=, =%:toname=, =%:toaddress= | > | | =%:date= (message date header field) | > | | =%:date-timestamp= (date as active timestamp) | > | | =%:date-timestamp-inactive= (date as inactive timestamp) | > | | =%:fromto= (either "to NAME" or "from NAME")[fn:32] | Thanks, this is helpful. I hadn't thought at all about these %:keyword expansions because I'm not (exclusively) interested in capturing these data in links. If this existing syntax were generalized to work anywhere in a template, that would pretty much cover what I want to do, I think. It's unclear to me how these actually work. The documentation just says: > ‘%:keyword’ > Specific information for certain link types, see below. > > For specific link types, the following keywords are defined(2): and then the table you quoted follows. Can you already put such %:keyword expansions anywhere in a template? Or do they have to be inside link syntax with the corresponding link type to get expanded? The documentation suggests it's the latter but maybe I'm wrong about this. As for an example, here's a simple one. Suppose I have written an email that says e.g. > How about we meet on Thursday at 3PM in my office? The code I've got parses this into an iCalendar event which is attached to the email, which includes a title, date and time, and location information. What I'm trying to do is call org-capture via a hook with the data I've already parsed, in order to save this data in the user's preferred format and location. So e.g. the user might want to write a template like: #+begin_example * %:summary %:date-timestamp :PROPERTIES: :LOCATION: %:location :END: #+end_example to get e.g.: #+begin_example * Feedback meeting <2026-11-26 Thu 15:00> :PROPERTIES: :LOCATION: Room 123, Address etc. :END: #+end_example ...so that the meeting can be captured somewhere that shows up in the user's agenda. Thus it's important to be able to use at least all the bits of Org syntax that are relevant for scheduled events, including timestamps and properties like :LOCATION:. Make sense? The %:keyword syntax, expanded via a plist I can provide/override, is enough to do the job, *if* that syntax can go anywhere in a template. Best, Richard
