emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>, Van L <van@scratch.space>
Cc: org-mode-email <emacs-orgmode@gnu.org>,
	John Kitchin <jkitchin@andrew.cmu.edu>
Subject: Re: C++ is not accepted for SRC block evaluation
Date: Mon, 28 May 2018 16:57:05 +0100	[thread overview]
Message-ID: <874liru626.fsf@gmail.com> (raw)
In-Reply-To: <878t843iws.fsf@nicolasgoaziou.fr>

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	other threads:[~2018-05-28 15:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 12:15 C++ is not accepted for SRC block evaluation Van L
2018-05-26 14:50 ` John Kitchin
2018-05-27  2:50   ` Van L
2018-05-27 20:24     ` Nicolas Goaziou
2018-05-27 20:48       ` Aaron Ecay
2018-05-27 21:09         ` Nicolas Goaziou
2018-05-28 15:57           ` Aaron Ecay [this message]
2018-05-30 11:11             ` Nicolas Goaziou
2018-05-30 16:35               ` Berry, Charles

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=874liru626.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=mail@nicolasgoaziou.fr \
    --cc=van@scratch.space \
    /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).