Richard Lawrence <[email protected]> writes: > pinmacs <[email protected]> writes: > >> On 2026-10-24 07:10, Richard Lawrence wrote: >>> pinmacs <[email protected]> writes: >>> >>>> On 2026-10-20 08:06, Richard Lawrence wrote: >>>>> Looking more closely at how org-capture works, I see I can't expect to >>>>> put stuff into org-capture-plist myself, because that's overwritten by >>>>> the capture template entry at the beginning of org-capture. But there >>>>> are a variety of variables I can let-bind, e.g. org-capture-initial, >>>>> org-overriding-default-time, and org-capture-link-is-already-stored. So >>>>> that's probably the right approach...? > >>> That's more or less the approach I've settled on. >>> I'm binding org-capture-initial and org-overriding-default-time so >>> a simple template like "* %i %T" works. >>> >>> Neither of these variables is documented, though -- I'm not sure if >>> that's just an oversight, or if it means "Please don't use this as a >>> public API". >> >> Yes that looks more risky than defining our own vars, in any case, it >> would be nice to document/agree on how to extend org-capture > > Carsten, Ihor, could you perhaps comment on this? Is it safe to bind > these variables from external code, or should I avoid it? Would you be > interested in a patch to add docstrings to them?
I plan to add docstring for org-overriding-default-time: (defvar org-overriding-default-time nil "When non-nil, default time to be used by `org-read-date'. This time is used regardless of the other time arguments and other contexts. The value must be a time object, as in `current-time'.") org-capture-initial and org-capture-link-is-already stored will likely stay internal. 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. However, actually passing the data through that plist requires binding org-capture-link-is-already, which is a kludge introduced specifically for this purpose. It is not the best design. We should better allow a specialized variable like org-capture-metadata-plist or similar that will be used in addition to org-store-link-plist. Patches or better design ideas are welcome. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
