emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] C++ is not accepted for SRC block evaluation


From: Aaron Ecay
Subject: Re: [O] C++ is not accepted for SRC block evaluation
Date: Mon, 28 May 2018 16:57:05 +0100
User-agent: Notmuch/0.26 (https://notmuchmail.org) Emacs/27.0.50 (x86_64-pc-linux-gnu)

Hi Nicolas,

2018ko maiatzak 27an, Nicolas Goaziou-ek idatzi zuen:

[...]

> 
> We probably need to implement a mapping between languages symbols and
> files and use it in `org-babel-do-load-languages'. The implicit mapping
> it uses currently has shortcomings.
> 
> We could also leave it like this (even with my patch reverted), and
> document it somehow. Maybe a third column per language in (info "(org)
> Languages") to hold the file name.
> 
> WDYT?

Improved documentation is never a bad thing.  OTOH, I personally would
not spend time on implementing the mapping you propose.
org-babel-do-load-languages is IMO a relic.  I think that all babel
languages should be autoloaded, just like normal lisp libraries are.

If I had to sketch a design for this, it would be a macro like:

(org-babel-define-language R
  :evaluate org-babel-R-evaluate
  :session org-babel-R-creaete-session
  :language-name "R"              ;; Both these Could be optional, with the
  :language-mode R-mode           ;; default calculated from the language name
  ...)

This macro would expand to:

(add-to-list org-src-lang-modes ...)
(add-to-list org-babel-tangle-lang-exts ...)
;; Possibly some others ...
(add-to-list org-babel-languages-alist
             '(R . (evaluate . org-babel-R-evaluate)
                   (session . org-babel-R-create-session)
                   ...))

The intent of the last one would be to get rid of all the
(fboundp (intern (concat "org-babel-thingy:" language))) stuff.

The org-babel-define-language call(s) in each ob-foo.el file would be
marked as autoloads, so that the relevant alists would all be fully
populated on emacs startup.  org-babel-(do-)load-languages would
disappear.

Iʼve held back on implementing this (among other reasons) because it
would be a big disruption to the babel ecosystem.  For all the languages
in core and contrib it would be manageable, but there are third-party
libraries that would have to be transitioned as well, plus the growing
pains of user config files, etc.  It would not be a small project.

(OTOH, I see other benefits as well.  In the longer term, it would be
nice to solve the longstanding problems with e.g. the python backend
by communicating with a jupyter kernel, rather than trying to drive a
python repl attached to a pipe.  A more manageable API for babel
languages than (fboundp (intern "magic-name")) would probably make it
easier to implement this.)

...in any case, the mapping that you propose is not an unreasonable idea in
the abstract.  But the problem only arises (AFAIK) for the C++/D languages,
and itʼs been with us for a long time.  My own opinion is that we can just
document and live with the situation until something much better comes
along.  But I also donʼt want to stop you from implementing a small and
reasonable fix if you are motivated to do so. :)

-- 
Aaron Ecay



reply via email to

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