jman <emacs-orgm...@city17.xyz> writes:

> I'd like to call an arbitrary elisp function over an org-mode snippet
> in a code block identified by BEGIN_SRC and END_SRC.
> Specifically, I want to run `org-icalendar-export-to-ics` over the following 
> org-mode agenda entry:
>
> #+NAME: run-me
> #+BEGIN_SRC org :results output
> ,* Meet friends
> :PROPERTIES:
> :LOCATION: At Stacy's
> :NOTES: Be on time
> :DESCRIPTION: The good season has just begun
> :END:
> <2025-05-28 Wed 20:00-22:00>
> #+END_SRC
>
> The expected result should be the output of `org-icalendar-export-to-ics`.

For more targeted help, perhaps also include the draft elisp function
and the src block you'll call it from.

With a src block with ~#+BEGIN_SRC elisp :var e=run-me~, the org source
from the above block would be available as the value of the variable
`e', a string, so you can call any arbitrary elisp function on it that
takes a string argument.

Org-icalendar-export-to-ics doesn't, but works from the assumption that
you're in a buffer visiting a file. So your elisp function might perhaps
first copy the src block into a buffer, unescape the escaped lines, and
save the file somewhere, before calling org-icalendar-export-to-ics from
that buffer. Is that what you're doing?

Yours,
Christian

Reply via email to