[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] org-babel-do-load-languages
From: |
N. Raghavendra |
Subject: |
[O] org-babel-do-load-languages |
Date: |
Thu, 03 May 2018 16:49:01 +0530 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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 <address@hidden>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/