emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "N. Raghavendra" <nyraghu27132@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org-babel-do-load-languages
Date: Thu, 03 May 2018 19:24:35 +0530	[thread overview]
Message-ID: <876044q1yc.fsf@gmail.com> (raw)
In-Reply-To: <87zi1gsx9i.fsf@gmail.com> (Aaron Ecay's message of "Thu, 03 May 2018 14:07:37 +0100")

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 <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/

  reply	other threads:[~2018-05-03 13:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` N. Raghavendra [this message]
     [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=876044q1yc.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).