emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] [PATCH] org-babel-execute-buffer: Prevent executing non-code b


From: Damien Cassou
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

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 via email to

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