emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "N. Raghavendra" <nyraghu27132@gmail.com>
To: emacs-orgmode@gnu.org
Subject: org-babel-do-load-languages
Date: Thu, 03 May 2018 16:49:01 +0530	[thread overview]
Message-ID: <87d0ydq95m.fsf@gmail.com> (raw)

I am puzzled with this definition:

------------------------------------------------------------
(defun org-babel-do-load-languages (sym value)
  "Load the languages defined in `org-babel-load-languages'."
  (set-default sym value)
  (dolist (pair org-babel-load-languages)
    (let ((active (cdr pair)) (lang (symbol-name (car pair))))
      (if active
          (require (intern (concat "ob-" lang)))
        (funcall 'fmakunbound
                 (intern (concat "org-babel-execute:" lang)))
        (funcall 'fmakunbound
                 (intern (concat "org-babel-expand-body:" lang)))))))
------------------------------------------------------------

First, the documentation string doesn't explain the significance of the
parameters SYM and VALUE.  Second, the main part of the function, that
is, the expression

(dolist (pair org-babel-load-languages) ...)

does not refer either to SYM or VALUE.  Therefore, I suggest changing
the definition along the following lines:

------------------------------------------------------------
(defun my-org-babel-do-load-languages (languages)
  "Load languages as specified by LANGUAGES.
LANGUAGES must be a list, each element of which is of the form
(LANG . ACTIVE), where LANG is the identifier of a supported
language, and ACTIVE is either t, for loading LANG, or nil, for
unloading LANG.  For a list of the supported languages and their
identifiers, see the Info node `(Org)Languages'."
  (set-default org-babel-load-languages languages)
  (dolist (pair org-babel-load-languages)
    (let ((active (cdr pair)) (lang (symbol-name (car pair))))
      (if active
          (require (intern (concat "ob-" lang)))
        (funcall 'fmakunbound
                 (intern (concat "org-babel-execute:" lang)))
        (funcall 'fmakunbound
                 (intern (concat "org-babel-expand-body:" lang)))))))
------------------------------------------------------------

I also suggest a corresponding change in Org(Languages):

------------------------------------------------------------
   By default, only ‘emacs-lisp’ is enabled for evaluation.  To enable
or disable other languages, customize the ‘org-babel-load-languages’
variable either through the Emacs customization interface, or by adding
code to the init file as shown next:

   In this example, evaluation is disabled for ‘emacs-lisp’, and enabled
for ‘R’.

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

Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

             reply	other threads:[~2018-05-03 11:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 11:19 N. Raghavendra [this message]
2018-05-03 11:38 ` org-babel-do-load-languages N. Raghavendra
2018-05-03 13:07 ` org-babel-do-load-languages Aaron Ecay
2018-05-03 13:54   ` org-babel-do-load-languages N. Raghavendra
     [not found]     ` <87in84rfim.fsf@gmail.com>
2018-05-04  2:38       ` org-babel-do-load-languages N. Raghavendra
2018-05-03 19:58 ` org-babel-do-load-languages Nicolas Goaziou
2018-05-04  2:31   ` org-babel-do-load-languages N. Raghavendra

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=87d0ydq95m.fsf@gmail.com \
    --to=nyraghu27132@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).