GNU bug report logs -
#52545
29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks
Previous Next
Full log
Message #21 received at 52545 <at> debbugs.gnu.org (full text, mbox):
> On Dec 18, 2021, at 1:49 AM, Ihor Radchenko <yantar92 <at> gmail.com> wrote:
>
> "Berry, Charles" <ccberry <at> health.ucsd.edu> writes:
>
>> If I have a typo in the name of a language, the error message you quote tells me what my mistake was.
>>
>> I'd say that is a feature, not a bug.
>
> Agree. However, some languages simply do not define babel execute
> function. The error is same regardless whether a language backend is not
> available/not loaded or the backend is loaded, but does not provide
> babel execute function.
>
> Maybe we can provide a custom list of languages where we do not throw
> the error? If a language is in the list and there is no babel execute
> function, we can simply ignore the source block. If a language is in the
> list, but there is babel execute function, we throw another error.
>
> Though I am not a big fan of introducing yet another customisation.
> Maybe someone has better ideas?
>
I believe there is a feeling that org-babel is already so complicated that adding features should be avoided.
There are workable approaches under the current setup.
---
For one, you can define lang specific header-args, so just define :eval no for the lang's that you want to use, but that do not have org-babel-execute:<lang> defined:
#+property: header-args:nada :eval no
#+property: header-args :exports both :eval yes
The code here will be rendered, but the block will not execute:
#+begin_src nada
"haha"
#+end_src
---
Another is to use a custom :eval arg like this:
#+property: header-args :eval (my-eval-p) :exports both
#+begin_src not_defined
"haha"
#+end_src
Where `my-eval-p' is defined as:
#+begin_src emacs-lisp
(defun my-eval-p ()
(let ((lang (car (org-babel-get-src-block-info 'light))))
(if (fboundp (intern (concat "org-babel-execute:" lang)))
"yes"
"no")))
#+end_src
Obviously, you can elaborate `my-eval-p' to satisfy individual needs.
Best,
Chuck
This bug report was last modified 3 years and 162 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.