emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel-do-load-languages
@ 2018-05-03 11:19 N. Raghavendra
  2018-05-03 11:38 ` org-babel-do-load-languages N. Raghavendra
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: N. Raghavendra @ 2018-05-03 11:19 UTC (permalink / raw)
  To: emacs-orgmode

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/

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

end of thread, other threads:[~2018-05-04  2:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-03 11:19 org-babel-do-load-languages N. Raghavendra
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

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