emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-babel-do-load-languages


From: N. Raghavendra
Subject: Re: [O] org-babel-do-load-languages
Date: Thu, 03 May 2018 19:24:35 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

At 2018-05-03T14:07:37+01:00, Aaron Ecay wrote:

> Itʼs an unusual function indeed.  Thatʼs because it is used as the :set
> function for the defcustom org-babel-load-languages; see the info
> documentation (info "(elisp) Variable Definitions").

Thank you for explaining.  I still think it would be better to avoid
unexplained parameters in the user-level function
org-babel-do-load-languages.  I wonder if something like

------------------------------------------------------------
(defun 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'."
  (setq-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)))))))

(defcustom org-babel-load-languages '((emacs-lisp . t))
   ...
   :set #'(lambda (sym value)
            (ignore sym)
            (org-babel-do-load-languages value))
   ...)
------------------------------------------------------------

looks reasonable.

Raghu.

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



reply via email to

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