unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* org-babel: how to evaluate code block with "alias" language?
@ 2022-11-22 20:29 North Year
  2022-11-23 20:35 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: North Year @ 2022-11-22 20:29 UTC (permalink / raw)
  To: help-gnu-emacs


suppose I want to evaluate the following code block in an org file:

#+begin_src r
data.frame(
    dog = rnorm(5),
    cat = rnorm(5)
)
#+end_src

then I will get the following error:
"org-babel-execute-src-block: No org-babel-execute function for r!"

I tried the following config in my init file, but they does not to work

#+begin_src emacs-lisp

(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)))

(add-to-list 'org-src-lang-modes '("r" . R))
#+end_src

and the following elisp

#+begin_src emacs-lisp
(org-babel-do-load-languages
 'org-babel-load-languages
 '((r . t)))
#+end_src

will yield error:
"failed to provide feature ‘ob-r’"

I know this problem is trivial to solve by simply replace "r" by "R".
However aliases are something expected to frequently happened and
can anyone has idea on how to make evaluating code blcok with "alias" language work?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-babel: how to evaluate code block with "alias" language?
  2022-11-22 20:29 org-babel: how to evaluate code block with "alias" language? North Year
@ 2022-11-23 20:35 ` Bastien
  2022-11-24  2:03   ` North Year
  2022-11-24  5:23   ` tomas
  0 siblings, 2 replies; 4+ messages in thread
From: Bastien @ 2022-11-23 20:35 UTC (permalink / raw)
  To: North Year; +Cc: help-gnu-emacs

Hi North,

North Year <ny-ml@outlook.com> writes:

> #+begin_src emacs-lisp
> (org-babel-do-load-languages
>  'org-babel-load-languages
>  '((r . t)))
> #+end_src

I suggest you try with an uppercase "R":

#+begin_src emacs-lisp
(org-babel-do-load-languages
 'org-babel-load-languages
 '((R . t)))
#+end_src

If Org's documentation is not accurate about this, please report a bug
with M-x org-submit-bug-report RET.

-- 
 Bastien



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-babel: how to evaluate code block with "alias" language?
  2022-11-23 20:35 ` Bastien
@ 2022-11-24  2:03   ` North Year
  2022-11-24  5:23   ` tomas
  1 sibling, 0 replies; 4+ messages in thread
From: North Year @ 2022-11-24  2:03 UTC (permalink / raw)
  To: Bastien; +Cc: help-gnu-emacs

Bastien <bzg@gnu.org> writes:

> Hi North,
>
> North Year <ny-ml@outlook.com> writes:
>
>> #+begin_src emacs-lisp
>> (org-babel-do-load-languages
>>  ’org-babel-load-languages
>>  ’((r . t)))
>> #+end_src
>
> I suggest you try with an uppercase “R”:
>
> #+begin_src emacs-lisp
> (org-babel-do-load-languages
>  ’org-babel-load-languages
>  ’((R . t)))
> #+end_src
>
> If Org’s documentation is not accurate about this, please report a bug
> with M-x org-submit-bug-report RET.

Thanks for your advice. I already mentioned in the original thread that
I know I can simply replace “r” by “R”.
But I am asking about if there is some general solution for this.

The nuance of “R” and “r” is just a simple example.
There might be other cases, like “Fortran” vs “F90”,
“js” vs “javascript”, “c” vs “C”, “cpp” vs “c++”.

“org-src-lang-modes” only affect syntax highlight,
but has nothing to do with org-babel evaluation.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-babel: how to evaluate code block with "alias" language?
  2022-11-23 20:35 ` Bastien
  2022-11-24  2:03   ` North Year
@ 2022-11-24  5:23   ` tomas
  1 sibling, 0 replies; 4+ messages in thread
From: tomas @ 2022-11-24  5:23 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 574 bytes --]

On Wed, Nov 23, 2022 at 09:35:36PM +0100, Bastien wrote:
> Hi North,
> 
> North Year <ny-ml@outlook.com> writes:
> 
> > #+begin_src emacs-lisp
> > (org-babel-do-load-languages
> >  'org-babel-load-languages
> >  '((r . t)))
> > #+end_src
> 
> I suggest you try with an uppercase "R":

There is an "r", which is basically a flavour of "R" [1] (it's
actually just an R with some initialization stuff making it
friendlier for some tasks).

I think that's what the OP was pointing at.

Cheers

[1] https://dirk.eddelbuettel.com/code/littler.html

-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-24  5:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 20:29 org-babel: how to evaluate code block with "alias" language? North Year
2022-11-23 20:35 ` Bastien
2022-11-24  2:03   ` North Year
2022-11-24  5:23   ` tomas

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).