emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [feature request] The :pre header argument


From: Ihor Radchenko
Subject: Re: [feature request] The :pre header argument
Date: Mon, 05 Apr 2021 12:49:09 +0800

Hi,

Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:

> I've provided more relevant information on this feature request [[
> https://codeberg.org/rdrg109/gists/src/branch/main/feature-request-pre-header-argument.org][here]].
> Please consider reading that instead of the first message on this thread.

I think the origin intention of the :post header argument is slightly
different from your use-case. It is intended to be used for
post-processing the results:

> The ‘post’ header argument is for post-processing results from block
> evaluation.  When ‘post’ has any value, Org binds the results to
> ‘*this*’ variable for easy passing to ‘var’ header argument
> specifications (see *note Environment of a Code Block::).  That makes
> results available to other code blocks, or even for direct Emacs Lisp
> code execution.

If you want to execute some arbitrary code before/after your code block,
it is probably more canonical to use noweb references. Using your
example:

#+begin_src emacs-lisp
# Cleanup first using experiments/clean-dir(): "<<experiments/clean-dir()>>"
# Create dir structure using
# minimal-reproducible-example/create-dir-structure:
# "<<minimal-reproducible-example/create-dir-structure()>>"
# Finally, execute `tree' using experiments/execute-tree:
(message "<<experiments/execute-tree()>>")
#+end_src

It will not produce spurious variable definitions.

Best,
Ihor






reply via email to

[Prev in Thread] Current Thread [Next in Thread]