emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ob-lisp determining package


From: Alan Ruttenberg
Subject: ob-lisp determining package
Date: Sun, 26 Dec 2021 20:25:12 -0500

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]