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...? > > I don't know if it is the right way, but I have some examples in my > config [1] where I abuse the usage of org-capture to do what I want. > Just in case that inspires you, if not, sorry the noise. > > I have some org-capture templates that I call "hybrid", that means that > they can be interactive, or they can be filled automatically. > > For example, for appointments, this is the non-interactive version, that > I define in a function (which is useful to schedule the regular week > appointments/tasks [1.5]): > > (my/fappt :appt-type "presencial" :title "yoga" :date "Mon > 09:15" :tag "body" :effort "1:00" :location "yoga center") > > And that calls the org-capture definition: > > (";a" "Noninteractive Agenda Appointment" entry (file+function > my/diary-file-fp my/prepare-appt) (file > "~/org/org-capture-templates/appointment_hybrid.org") :empty-lines 1 > :prepend t :jump-to-captured nil :immediate-finish t) > > So in the template appointment_hybrid.org [2] I have custom vars, m/p is > a short-simple function to ensure that custom vars are inserted in the > template
Thanks! So basically, you're binding your own variable (containing a plist) around org-capture, and then using Elisp forms in your templates to read that variable, right? That's more or less the approach I've settled on, with the addition that I'm also 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". Best, Richard
