emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Berry, Charles" <ccberry@health.ucsd.edu>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: "Rudolf Adamkovič" <salutis@me.com>,
	"Kyle Meyer" <kyle@kyleam.com>,
	"52545@debbugs.gnu.org" <52545@debbugs.gnu.org>
Subject: bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks
Date: Sat, 18 Dec 2021 19:57:03 +0000	[thread overview]
Message-ID: <E48CD180-2EBC-47C0-B315-6E82C31477C7@health.ucsd.edu> (raw)
In-Reply-To: <87y24ib5v1.fsf@localhost>



> On Dec 18, 2021, at 1:49 AM, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> "Berry, Charles" <ccberry@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






  reply	other threads:[~2021-12-18 20:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2h7b8u9a7.fsf@me.com>
2021-12-17  4:51 ` bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks Kyle Meyer
2021-12-17 19:25   ` Berry, Charles
2021-12-18  9:49     ` Ihor Radchenko
2021-12-18 19:57       ` Berry, Charles [this message]
2021-12-18 20:13         ` Berry, Charles
2021-12-21 22:53       ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-21 23:14         ` Berry, Charles
2021-12-22 15:04         ` Ihor Radchenko
2021-12-23 22:00           ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-24  4:09             ` Ihor Radchenko
2021-12-24 19:52               ` Berry, Charles
2021-12-25 21:37                 ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-25 23:34                   ` Berry, Charles
2021-12-30  7:26                     ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-30  8:00                       ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-31 12:05                         ` Max Nikulin
2021-12-31 19:11                           ` Berry, Charles
2022-01-01 20:32                             ` Rudolf Adamkovič via General discussions about Org-mode.
2022-01-01 20:23                           ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-30 20:14                       ` Berry, Charles
2021-12-29 12:53                 ` Max Nikulin
2021-12-29 17:47                   ` Berry, Charles
2021-12-30 15:41                     ` Max Nikulin
2021-12-25 21:40               ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-26 12:49             ` Max Nikulin
2021-12-26 13:27               ` Ihor Radchenko
2022-01-04 14:59                 ` Max Nikulin
2021-12-26 19:51               ` Rudolf Adamkovič
2021-12-27 11:18                 ` Max Nikulin
2021-12-27 21:37                   ` Rudolf Adamkovič via General discussions about Org-mode.
2021-12-28 11:45                     ` Max Nikulin
2021-12-28 20:39                       ` Rudolf Adamkovič via General discussions about Org-mode.

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=E48CD180-2EBC-47C0-B315-6E82C31477C7@health.ucsd.edu \
    --to=ccberry@health.ucsd.edu \
    --cc=52545@debbugs.gnu.org \
    --cc=kyle@kyleam.com \
    --cc=salutis@me.com \
    --cc=yantar92@gmail.com \
    /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).