From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:f42::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GMG4CQzoy2G5MgEAgWs5BA (envelope-from ) for ; Wed, 29 Dec 2021 05:46:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 6H2YBgzoy2GAzwAAauVa8A (envelope-from ) for ; Wed, 29 Dec 2021 05:46:04 +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 A5CCBA369 for ; Wed, 29 Dec 2021 05:46:03 +0100 (CET) Received: from localhost ([::1]:37102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2Qqg-0002mV-65 for larch@yhetil.org; Tue, 28 Dec 2021 23:46:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n1en2-0004s7-Bp for emacs-orgmode@gnu.org; Sun, 26 Dec 2021 20:27:04 -0500 Received: from [2607:f8b0:4864:20::833] (port=34781 helo=mail-qt1-x833.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n1en0-0001vI-Pl for emacs-orgmode@gnu.org; Sun, 26 Dec 2021 20:27:03 -0500 Received: by mail-qt1-x833.google.com with SMTP id o17so12425432qtk.1 for ; Sun, 26 Dec 2021 17:27:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=vQa4f7RcfmO95PDTAankImAJB5VDho0Y3oi/l9cqvRs=; b=DfF64nF1W7wJjSjRvGXKY2nNbCcD6Fg8O+lNXU3p+TLO4f5vDLImOSGfdAzvOHlJYc hB//nWz28V8DuuFgTCO6q/S7Qa+MoAKJA4UrjecBCjy4tosdfPorfnJhOqxlJUI8NrtN IJMpcESsDZAoqCHrBgvVhCWkpWiYgmE4pXLvaT4Ferahs2dky2vMfjkzee9MNl6Sqj7Y D+V7njZbpxOZLxMo/LegcXsCScmEUfMPCwsqF58Q2F6YHsfp6Fd10coDzOI60fXQpiNp rlaFzeyNrX3gZletkmMEOKGOX3doTckmoTI+onq4agnlgJSMROdGqgeRIZVeWokhUE1K tVrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=vQa4f7RcfmO95PDTAankImAJB5VDho0Y3oi/l9cqvRs=; b=sw5Tm6ZsR+kvZ9niiEY48LAbAkz/7ntZCynsmhj3ErEy22KJ0lQFvzqpJoXkOnWqSS VCvhwfvTD18G5ZZ5JlWYWNP7jCpIT/VWRUmRehsQtetZxgKLFFKA8xwo5gy/X+zcY/QI YtjI6LDgqswwFgSCDQOJ9PTT4hSMLKXEXjVJXqOcxgT0ul8DI3uXf06pIFXNLIsKo+Jq JWnYX6ex5mkWjCCGnDJDlmg0yBt+qtAJIVyC2Cgk/DrNbLMR4wlMjF6PJdbbASED1aF9 wxPNX9FFdVHTanWLGKvUjWMh+giwVf2cFbA98/o4Nyt9vGj5S1JUmmUSN0qcdrJJY82w IuUw== X-Gm-Message-State: AOAM531LateVlTRR0BHBCVGbAYFl8/sRdEBDS2V7I9hoPRXhr+ArqBIG DlXu/K3eAdeD7/6L9EUvFtO3WGJ9YqUb4QD6EdiVpebKteg= X-Google-Smtp-Source: ABdhPJzPMN9gAhPRig/55EA1hBc4PfRjCVv+P4r9qh2zI90elIKjUmqUoV/5JT4HHUVqjNNKqa3KxcF5ncu5GWaQu8s= X-Received: by 2002:ac8:5a90:: with SMTP id c16mr13151361qtc.199.1640568421095; Sun, 26 Dec 2021 17:27:01 -0800 (PST) MIME-Version: 1.0 From: Alan Ruttenberg Date: Sun, 26 Dec 2021 20:25:12 -0500 Message-ID: Subject: ob-lisp determining package To: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000f81c2805d4169920" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::833 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::833; envelope-from=alanruttenberg@gmail.com; helo=mail-qt1-x833.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 28 Dec 2021 23:44:32 -0500 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640753163; 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=vQa4f7RcfmO95PDTAankImAJB5VDho0Y3oi/l9cqvRs=; b=lJ3NWKiJFwOO6rVd7VGaSuGDzTtSFZsqcrC6TZ9hdfAw7j1oD01XBH6TjE9YoKweX1l/m0 Y7kK4OxgVJiCfdgxkPqQoc0DIeu1S7m0+SGdxdC6CMVxHU7TuFYEx4iKGQiD8hEOWB/EQl 4sQ/e3tIDLKybbFgh+Itstkp62ii9ImxNdad6zNyAaK+adD09AYgEOATH/uFOyRKrd5i2v lG/J9lIhKePAdq2/w6M9k0xBD6flINNX9hhftgKO1oqHd9YnMZYeG8HjYek7ZHrGuXrIQy bmh/iBkiyx0DeIJQFl2qpbLfUPnzs9llbDksbOr1mc68yfX3d/KTl3277/ZQmg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640753163; a=rsa-sha256; cv=none; b=dQ0VoRFltKyj++HKd0JSQn+XATWZ9ks/WQ2hxJzh1iOc5iB1ap+W2eeosikcQnirFH8eUp q5tKsDrIduiLmmgMCM70VCLR/2rNEl8On9tJQYnjn1+q4SGfkj/FQea/CU2Ja+YUeEp+pk rYuEf2zftaNQj+EXmlcI92ZU9wsNYdhOxRLwcv811UjcF9BDvLExcZd1W2Ii+aAmgMSaGZ lozurws/tNTuVgN9Do9Dof45krhD0MYwwGUA1p9K57bEuB0IAoDUkVkCrDriHPy+cf8XXe FS4038Vct8PhKxXG1r6Xqevyq9Buw7tTe58lfw43Mk/lA3kUfrz7jGIHt1JBQw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DfF64nF1; 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-Spam-Score: -3.27 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DfF64nF1; 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-Queue-Id: A5CCBA369 X-Spam-Score: -3.27 X-Migadu-Scanner: scn1.migadu.com X-TUID: /XN/3/v5V6CG --000000000000f81c2805d4169920 Content-Type: text/plain; charset="UTF-8" Currently, ob-lisp expects a package as a header argument. This is inconvenient and often unnecessary. Slime (or sly) provides a function to determine the current package: slime-current-package (sly-current-package). The function used to do the evaluation in lisp is slime-eval (sly-eval) and this function takes a second argument which is the package. The current code determining the package is (in org-babel-execute:lisp), (cdr (assq :package params)). As I understand it, on entry to org-babel-execute:lisp, the current buffer is the org buffer, and the point is at the beginning of the #+begin_src line. slime/sly-current-package works just fine in that context. I propose that the package determination be changed to (or (cdr (assq :package params)) (funcall org-babel-lisp-package-fn)) with org-babel-lisp-package-fn being bound analogous to how org-babel-lisp-eval-function is: (require (pcase org-babel-lisp-package-fn (`slime-current-package 'slime) (`sly-current-pacakge 'sly))) This (approximately) seems to work fine in my emacs. However, I am using an older version of emacs/org-mode and so am not submitted a patch, which would be against slightly different code. Regards, Alan --000000000000f81c2805d4169920 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Currently, ob-lisp expects a package as a header argu= ment. This is inconvenient and often unnecessary. Slime (or sly) provides a= function to determine the current package: slime-current-package (sly-curr= ent-package). The function used to do the evaluation in lisp is slime-eval = (sly-eval) and this function takes a second argument which is the package. =

The current code determining the package is (= in org-babel-execute:lisp),=C2=A0 (cdr (assq :package params)). As I unders= tand it, on entry to org-babel-execute:lisp, the current buffer is the org = buffer, and the point is at the beginning of the #+begin_src line. slime/sl= y-current-package works just fine in that context.

I propose that the package determination be changed to

(or (cdr (assq :package params)) (funcall org-babel-lisp-pa= ckage-fn))

with org-babel-lisp-package-fn being bo= und analogous to how org-babel-lisp-eval-function is:

=C2=A0(requi= re (pcase org-babel-lisp-package-fn
=C2=A0 =C2=A0 (`slime-current-pack= age=C2=A0 'slime)
=C2=A0 =C2=A0 (`sly-current-pacakge 'sl= y)))

This (approximately) seems to work fine in my= emacs. However, I am using an older version of emacs/org-mode and so am no= t submitted a patch, which would be against slightly different code.

Regards,
Alan
--000000000000f81c2805d4169920--