Ignacio Casso <[email protected]> writes:

>> What if there is :results silent?
>
> org-babel-insert-result is the one that handles the insertion and takes
> the silent param into account. If you are talking about a block being
> both cached and silent, that doesn't make sense to begin with so I think
> we can ignore that case (the same way I'm ignoring the case of a cached
> block with results = none)

Agree.

>> Please add :package-version and :type. Also, use `cached' to quote
>> symbol.
>
> :type was already there, I added :package-version with version 9.7

Now, the type is not just boolean, but can take several values.
:type should reflect that. For example, see :type in
`org-latex-default-table-mode'.

:package-version should reflect Org mode version when the changes are
introduced. That is Org 10.0 (next release).

>> What about babel calls?
>
> Sorry, I thought that the only way to evaluate blocks indirectly to
> resolve a reference was with org-babel-execute-src-block, but you are
> right that it can be done with babel calls too, it's right there in the
> code. I wasn't aware of that was even possible, but I tried to reproduce
> and indeed it is:
>
> #+name: babell-call-ref
> #+CALL: random(max=5)[:cache yes]
>
> #+begin_src emacs-lisp :var x=babell-call-ref :results replace
>   x
> #+end_src
>
> This case was not handled by the original org-babel-update-intermediate
> variable to begin with, so I didn't realize I had to handle it too. I've
> updated the patch to take it into account.
>
> There is another case which is not handled, the library of Babel, but I
> guess the user never wants to update it and it never has cached blocks,
> so it should be fine.

Agree.

> I updated the patch:
>
> From 40bddcbc0bedd0d728ed066d94f61f7f9d7f27fb Mon Sep 17 00:00:00 2001
> From: Ignacio Casso <[email protected]>
> Date: Mon, 9 Mar 2026 20:02:39 +0100
> Subject: [PATCH] org-babel: fix and extend `org-babel-update-intermediate'
>  variable

*Fix

> * lisp/ob-ref.el (org-babel-update-intermediate): make variable custom
> and add `cached' as new possible value to only update intermediate
> blocks when they have the :cache yes header argument.

*Make

> See https://list.orgmode.org/orgmode/[email protected]

Link: https://...

Also, please add a record to etc/ORG-NEWS announcing the new customization.

>                     (setq result-params (remove "file" result-params))))))
> -           (unless (member "none" result-params)
> +           (unless (and (member "none" result-params)
> +                           (not (and cache
> +                                     (eq 'cached 
> org-babel-update-intermediate))))

This will lead to compiler warning, because
`org-babel-update-intermediate' is not declared in ob-core.el.

In org-babel-execute-src-block:
ob-core.el:958:50: Warning: reference to free variable 
‘org-babel-update-intermediate’

I think you can simply more that variable to ob-core.el.

> +(defcustom org-babel-update-intermediate nil
> +  "Update the in-buffer results of code blocks executed to resolve 
> references.

When non-nil, update ...

> +If value is nil they will never be updated.  If value is non-nil they

If value is nil,

and so on (add commas)

> +will always be updated.  A value of `cached' means to only update them if
> +the block has the cache header argument set to yes.  This is needed
> +for the cache feature to work properly, as it relies on source block
> +results being printed in the Org buffer."


> +  :group 'org-babel
> +  :package-version '(Org . "9.7")

"10.0"

> +  :type 'boolean)

Update as I mentioned earlier.

Everything else looks good.

-- 
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>

Reply via email to