From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id yE7/L50EGmRpPQAASxT56A (envelope-from ) for ; Tue, 21 Mar 2023 20:25:17 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MCUXL50EGmSDiAAAG6o9tA (envelope-from ) for ; Tue, 21 Mar 2023 20:25:17 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7BB0BEEF5 for ; Tue, 21 Mar 2023 20:25:17 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pehak-0003Vy-R8; Tue, 21 Mar 2023 15:24:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pehai-0003V7-Ta for emacs-orgmode@gnu.org; Tue, 21 Mar 2023 15:24:16 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pehah-0002b4-29 for emacs-orgmode@gnu.org; Tue, 21 Mar 2023 15:24:16 -0400 Received: by mail-pl1-x634.google.com with SMTP id ja10so17139044plb.5 for ; Tue, 21 Mar 2023 12:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679426653; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=xQtCrTqqUZNjBZmwvlPLThRqtostCIzNqh6fd+J+mnQ=; b=mYoeVlEtWUhKkBk6/dNEPnSlXNiu0NfXWbOLfcujcfp0BM3VvPsNSTmk+Eerh5+hNg 9SwYb/H7HKKJOMOJ8vDDFjrHYw1xK14W6owqS0TLK8pQPYQgI1Arc6/tl8szb0Cg+Dhi 4hMOWj0dxK98iyZ50omcjQ72wbMeT5Q6EfjgayNXAs1bsaOLTswQilKQF0iCIQEdAOKQ g2AHF3DtBy2UEht2XZSbgdU9VkJqQrFEj7HI3fz09kcZ/1VLo3MaPM7kevUhk3ZOu3EU E357OUrC/LJpxSU0U58SfdajgLdOCuJmXb9/g06jvVUB0CIMIsLObuUCwLLybOP5/bbo pEDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679426653; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xQtCrTqqUZNjBZmwvlPLThRqtostCIzNqh6fd+J+mnQ=; b=o6TY1Pb9xrYwR5WU0JGyKKGonBurIlLaxawmfJfuZdpt4AslcN7+dB1T7hTkwP0anp MdTnGE3uLD6AyUo9RcZZj8gxcL4lkeM/hjhLpELL/7BYfJWuMrvoQblMZUigQZSN2klC Ig9jvaMZ2tzT4E/tUOc/aIM3nyaaK2jUCuoVtmanGD30gPf8mEXBdIQ6234Euodggmo8 szV/IDX1I4wnxy7YpwDdgRquaKAUQnPPjTOYOLUcZrgCQLsceUXXMOHwGYUHyC5bHAWZ oWwEJJB7IVwpk/urTW+3Mk0NNJkbUM+B5bHJYA3jVj79mEMzS40TgbA1QLpByYbxWFEY zT/Q== X-Gm-Message-State: AO0yUKW+w/fBu6YhXYeND6FAYBcf8fiQHARc9WMhsqj9z9WDV4vaXeEA QLq20p9wi/CyoS2N54w2n4lMD3tLHVM= X-Google-Smtp-Source: AK7set9yiZzvW9I+czIOcYS8y/n/LiT7MGRxrRmzmsPpBvM3RdEywsW2ppk1A7e/557/gJIjlmQidg== X-Received: by 2002:a17:90b:2d82:b0:23f:8ba9:849 with SMTP id sj2-20020a17090b2d8200b0023f8ba90849mr678963pjb.16.1679426652838; Tue, 21 Mar 2023 12:24:12 -0700 (PDT) Received: from localhost ([202.142.103.108]) by smtp.gmail.com with ESMTPSA id x4-20020a17090a530400b0023d0290afbdsm6078657pjh.4.2023.03.21.12.24.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 12:24:12 -0700 (PDT) Date: Wed, 22 Mar 2023 00:55:15 +0530 From: Mandar Mitra To: emacs orgmode-mailinglist Subject: Two low-priority questions re: design of org-babel-do-load-languages Message-ID: <20230321192515.uvhj4vdpwrztfdkp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=mandar.mitra@gmail.com; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679426717; a=rsa-sha256; cv=none; b=MfI0xmINohbWCshb4EnXNvc36PCOTztRwIj3qjBfl3wRN+zJ2oOhLxqmdWSZRHBGmhxC1s nGWrU2sKv39/Zokgxeyeq3qJsziXyciLMd4dQoX3dVYJtFJ9+tU01hA8gfkRPXsrvgPmoz TEZZSMq2iGd8ozhxjb4Tdy6sYBQyv8GyiUgKqrwtpJc7qrymb0m4pT8Snu2XCzOJxUEXal AYSLpAL3F4kx1h5vogwLThvMM6SN42Fwqi2RSe05ko+PxBVdpTBH4ldTaQWtloetrwT65Z Ioom1bNufuvDU98NmfrWgGIdlABiBlq+1R2zJ/Esi3kav4cpCi9ifcBPz4nmYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mYoeVlEt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679426717; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xQtCrTqqUZNjBZmwvlPLThRqtostCIzNqh6fd+J+mnQ=; b=WxMi2d4c8n953Wgo4Ho+zrxRGoJ1p/8Yn47zy7zFcz2NcSIW7T77XpBtnXvhMH4vcGmNVq 3JAF1iyLKyFrNNTzaPdWI1oDtnMHYrbCSgR3zJoG/4VTK9bh+u2rtNLM9t3D2nobaaFEOj H7MotLMDBfwl9orrR06UTiIX/oNhd+V35WhxhhgKm0D0CqLlYkf11G3M36UJDkbbCOqx3E mIxUtuogA35+MHGs3XZn2J87TSNA5sy2KYw7AgTVizkHc2qWwUWF3LIlHLdCm4xbKswUZG vP3poF9yuv8v29T5NOZsey8yA60oeqF4iugDpFjoH5JcLUJV4xGDtTsRQ1LHOg== X-Migadu-Spam-Score: -6.49 X-Spam-Score: -6.49 X-Migadu-Queue-Id: 7BB0BEEF5 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=mYoeVlEt; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-TUID: OU+qaGAjweSL Here's the code from my version of org.el (9.5.5, inbuilt in Emacs 28.2). (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))) (fmakunbound (intern (concat "org-babel-execute:" lang))) (fmakunbound (intern (concat "org-babel-expand-body:" lang))))))) 1. Question from purely a programming student's perspective: this seems to be doing two things: (i) a set-default on line 3, and (ii) actually loading the language support libraries. If one were re-designing from scratch, without worrying about backward compatibility, would it be cleaner to separate the above into (defun org-babel-do-load-languages () ; no arguments "Load the languages defined in `org-babel-load-languages'." (interactive) ; why not? (dolist (pair org-babel-load-languages) ... )) and (defun org-babel-update-loaded-languages (value) ; value seems enough, don't need sym "Update the value of `org-babel-load-languages' and call org-babel-do-load-languages" (set-default ...)) 2. This question https://emacs.stackexchange.com/questions/20577/org-babel-load-all-languages-on-demand asks: is there any way for org-babel to load support for languages when I actually try to use a code block with that language? [as opposed to customising org-babel-load-languages or similar] and the accepted answer suggests the following: (defadvice org-babel-execute-src-block (around load-language nil activate) "Load language if needed" ... What would be the downside of making load-on-demand the default for all languages? Then people wouldn't have to customise org-babel-load-languages. Apologies if this is not the right list for such "idle curiosity" type questions, and thanks for any insights! -mandar