From mboxrd@z Thu Jan 1 00:00:00 1970 From: "N. Raghavendra" Subject: org-babel-do-load-languages Date: Thu, 03 May 2018 16:49:01 +0530 Message-ID: <87d0ydq95m.fsf@gmail.com> Reply-To: "N. Raghavendra" Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fECGU-0001fb-Px for emacs-orgmode@gnu.org; Thu, 03 May 2018 07:19:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fECGR-0004g6-Lg for emacs-orgmode@gnu.org; Thu, 03 May 2018 07:19:10 -0400 Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]:37238) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fECGR-0004fh-Eh for emacs-orgmode@gnu.org; Thu, 03 May 2018 07:19:07 -0400 Received: by mail-pf0-x233.google.com with SMTP id e9so10460367pfi.4 for ; Thu, 03 May 2018 04:19:07 -0700 (PDT) Received: from riemann ([14.139.59.140]) by smtp.gmail.com with ESMTPSA id v12-v6sm20917695pgs.21.2018.05.03.04.19.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 04:19:05 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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 =E2=80=98emacs-lisp=E2=80=99 is enabled for evaluation.= To enable or disable other languages, customize the =E2=80=98org-babel-load-languages= =E2=80=99 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 =E2=80=98emacs-lisp=E2=80=99= , and enabled for =E2=80=98R=E2=80=99. (org-babel-do-load-languages '((emacs-lisp . nil) (R . t))) ------------------------------------------------------------ Raghu. -- N. Raghavendra , http://www.retrotexts.net/ Harish-Chandra Research Institute, http://www.hri.res.in/