From: Ihor Radchenko <yantar92@posteo.net>
To: Damien Cassou <damien@cassou.me>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] [PATCH] org-babel-execute-buffer: Prevent executing non-code blocks [9.6.20 ( @ /home/cassou/.emacs.d/lib/org/lisp/)]
Date: Tue, 12 Mar 2024 21:23:32 +0000 [thread overview]
Message-ID: <874jdbjga3.fsf@localhost> (raw)
In-Reply-To: <8734sv5fbt.fsf@cassou.me>
Damien Cassou <damien@cassou.me> writes:
> Ihor Radchenko <yantar92@posteo.net> writes:
>> Thanks for the patch, but it is not obvious that skipping src blocks
>> that cannot be executed is always a good idea. Consider, for example,
>> that some blocks are used as input for other blocks. Then, failing to
>> execute them means that other blocks may have unpredictable side
>> effects.
>
>
> I don't understand your position. Without this patch, executing
> `org-babel-execute-buffer' will just crash if a block can't be
> executed. What problem can skipping those could cause?
For example, consider
#+begin_src bash
mkdir foo
#+end_src
#+begin_src emacs-lisp
(write-file "foo/result")
#+end_src
The second block relies upon side effects of the first block.
However, if ob-shell is not loaded, with your patch, the side effect
will not happen.
One can construct more nasty examples when not executing prior block
leads to unexpected or even damaging results.
>> May you please provide a concrete use-case when skipping some src code
>> blocks is desired?
>
> I use text-mode blocks to represent output of bash scripts as in:
>
> #+name: repo-test-check
> #+begin_src sh :exports both :results output raw :wrap SRC text
> git log --oneline
> #+end_src
>
> #+RESULTS: repo-test-check
> #+begin_SRC text
> cfd2b (HEAD -> main) Empty
> #+end_SRC
>
> The second block can't be executed because no
> `org-babel-execute:text` function exists.
Why not simply adding :eval no header argument?
The problem with testing that `org-babel-execute:<lang>' function exists
is that we cannot distinguish between languages that cannot and should
not be executed and babel backends that are not loaded for some reason.
--
Ihor Radchenko // yantar92,
Org mode contributor,
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>
next prev parent reply other threads:[~2024-03-12 21:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-09 7:42 [BUG] [PATCH] org-babel-execute-buffer: Prevent executing non-code blocks [9.6.20 ( @ /home/cassou/.emacs.d/lib/org/lisp/)] Damien Cassou
2024-03-12 12:18 ` Ihor Radchenko
2024-03-12 21:07 ` Damien Cassou
2024-03-12 21:23 ` Ihor Radchenko [this message]
2024-03-16 10:39 ` Damien Cassou
2024-03-16 11:48 ` Ihor Radchenko
2024-03-16 18:30 ` Damien Cassou
2024-03-17 12:28 ` Gerard Vermeulen
2024-03-17 14:30 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874jdbjga3.fsf@localhost \
--to=yantar92@posteo.net \
--cc=damien@cassou.me \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.