Yes, definitely prefix the special var too, thank you. On Fri, Mar 7, 2025 at 13:51 Héctor Galbis Sanchis < hectometrocuadr...@gmail.com> wrote:
> Owen is right. If the user is using any package that doesn't 'use-package' > the "CL" package org will fail. > > I think the patch Owen provides is good. Just a little note on > `org-babel-lisp-dir-fmt`. I think the symbol `*default-pathname-defaults*` > should be `cl:*default-pathname-defaults*` too, since it is also from the > "CL" package. > > > El vie, 7 mar 2025 a las 3:35, Owen Radcliffe (<garlic...@gmail.com>) > escribió: > >> The use of Coalton can be considered a contrived example, although >> important to some people, but symbols not being prefixed assumes that users >> are in packages that (:use :cl) and don't shadow anything important. >> >> On Thu, Mar 6, 2025 at 13:58 Ihor Radchenko <yanta...@posteo.net> wrote: >> >>> Owen Radcliffe <garlic...@gmail.com> writes: >>> >>> > Here are steps to reproduce the issue I am fixing: >>> > >>> > 1. Start sly and load Coalton: >>> > - M-x sly >>> > - (asdf:load-system :coalton) >>> > >>> > 2. Enter the :coalton-user package, it does not use :cl >>> > - (in-package :coalton-user) >>> > >>> > 3. Evaluate the following org-babel src block: >>> > ``` >>> > #+begin_src lisp >>> > (coalton (1+ 1)) >>> > #+end_src >>> > ``` >>> >>> These steps are certainly not enough for someone who does not have >>> coalton (whatever it is) installed and configured, but I can see how >>> this might be a problem in theory. >>> >>> Since I am not familiar with CL, I am taking a liberty to ask Héctor >>> take a look at this to double-check whether the patch makes sense. >>> >>> Best, >>> Ihor >>> >>> > This signals the error below because it is using coalton:let instead of >>> > cl:let. >>> > ``` >>> > The operator LET is only valid in a Coalton expression. >>> > ``` >>> > >>> > With the patch attached, things behave properly. >>> > >>> > ``` >>> > #+begin_src lisp >>> > (coalton (1+ 1)) >>> > #+end_src >>> > >>> > #+RESULTS: >>> > : 2 >>> > ``` >>> > From 4f8e68416fbead2a5726fd4b867e63ae427b7641 Mon Sep 17 00:00:00 2001 >>> > From: Owen Radcliffe <garlic...@gmail.com> >>> > Date: Mon, 3 Mar 2025 22:10:17 -0500 >>> > Subject: [PATCH 1/1] prefix cl symbols so that ob-lisp.el can be used >>> without >>> > being in a package that uses :cl >>> > >>> > --- >>> > lisp/ob-lisp.el | 10 +++++----- >>> > 1 file changed, 5 insertions(+), 5 deletions(-) >>> > >>> > diff --git a/lisp/ob-lisp.el b/lisp/ob-lisp.el >>> > index ed5a4bb00..6e085491a 100644 >>> > --- a/lisp/ob-lisp.el >>> > +++ b/lisp/ob-lisp.el >>> > @@ -61,7 +61,7 @@ Valid values include `slime-eval' and `sly-eval'." >>> > :type 'symbol) >>> > >>> > (defcustom org-babel-lisp-dir-fmt >>> > - "(let ((*default-pathname-defaults* #P%S\n)) %%s\n)" >>> > + "(cl:let ((*default-pathname-defaults* #P%S\n)) %%s\n)" >>> > "Format string used to wrap code bodies to set the current >>> directory. >>> > For example a value of \"(progn ;; %s\\n %%s)\" would ignore the >>> > current directory string." >>> > @@ -77,10 +77,10 @@ current directory string." >>> > (prologue (cdr (assq :prologue params))) >>> > (epilogue (cdr (assq :epilogue params))) >>> > (body (if (null vars) (org-trim body) >>> > - (concat "(let (" >>> > + (concat "(cl:let (" >>> > (mapconcat >>> > (lambda (var) >>> > - (format "(%S (quote %S))" (car var) (cdr >>> var))) >>> > + (format "(%S (cl:quote %S))" (car var) (cdr >>> var))) >>> > vars "\n ") >>> > ")\n" >>> > (and prologue (concat prologue "\n")) >>> > @@ -89,7 +89,7 @@ current directory string." >>> > ")")))) >>> > (if (or (member "code" result-params) >>> > (member "pp" result-params)) >>> > - (format "(pprint %s)" body) >>> > + (format "(cl:pprint %s)" body) >>> > body))) >>> > >>> > (defun org-babel-execute:lisp (body params) >>> > @@ -115,7 +115,7 @@ a property list containing the parameters of the >>> block." >>> > default-directory))) >>> > (format >>> > (if dir (format >>> org-babel-lisp-dir-fmt dir) >>> > - "(progn %s\n)") >>> > + "(cl:progn %s\n)") >>> > (buffer-substring-no-properties >>> > (point-min) (point-max))))) >>> > (cdr (assq :package params))))))) >>> > -- >>> > 2.48.1 >>> > >>> >>> -- >>> Ihor Radchenko // yantar92, >>> Org mode maintainer, >>> Learn more about Org mode at <https://orgmode.org/>. >>> Support Org development at <https://liberapay.com/org-mode>, >>> or support my work at <https://liberapay.com/yantar92> >>> >>