emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien@cassou.me>
To: Ihor Radchenko <yantar92@posteo.net>
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: Sat, 16 Mar 2024 11:39:13 +0100	[thread overview]
Message-ID: <87h6h65ulq.fsf@cassou.me> (raw)
In-Reply-To: <874jdbjga3.fsf@localhost>

Hi Ihor,

Ihor Radchenko <yantar92@posteo.net> writes:
> 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.


If I understand correctly, you are saying that it is better to let the
command crash as soon as possible instead of letting it execute
potentially problematic code because some previous block has not been
executed. I think it makes perfect sense. I'm now convinced that my
patch is not desirable. Feel free to close the issue.


> Why not simply adding :eval no header argument?


Just because I didn't know it exists. Thank you for telling me. I have
now added it to all my code blocks generating non-executable results
using the :wrap keyword like this:

    #+name: show-tree
    #+begin_src sh :exports both :results output drawer :tangle yes :wrap "SRC text :eval no"
    echo foo
    #+end_src
    
    #+RESULTS: show-tree
    #+begin_SRC text :eval no
    foo
    #+end_SRC

It works very well, thanks! Would you say this is how you would have
done it as well or is there a better way?

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill


  reply	other threads:[~2024-03-16 10:40 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
2024-03-16 10:39       ` Damien Cassou [this message]
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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6h65ulq.fsf@cassou.me \
    --to=damien@cassou.me \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).