* ob-lisp determining package
@ 2021-12-27 1:25 Alan Ruttenberg
2022-04-29 9:20 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: Alan Ruttenberg @ 2021-12-27 1:25 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 1459 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ob-lisp determining package
2021-12-27 1:25 ob-lisp determining package Alan Ruttenberg
@ 2022-04-29 9:20 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-04-29 9:20 UTC (permalink / raw)
To: Alan Ruttenberg; +Cc: emacs-orgmode
Alan Ruttenberg <alanruttenberg@gmail.com> writes:
> 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.
Did you have a chance to test your changes against the latest Org?
If everything works fine, could you prepare a patch?
best,
Ihor
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-29 9:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-27 1:25 ob-lisp determining package Alan Ruttenberg
2022-04-29 9:20 ` Ihor Radchenko
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).