emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Ruttenberg <alanruttenberg@gmail.com>
To: emacs-orgmode@gnu.org
Subject: ob-lisp determining package
Date: Sun, 26 Dec 2021 20:25:12 -0500	[thread overview]
Message-ID: <CAFKQJ8=2ptR=7UFJOS8V1z=-cn3AbS3r2+b+faG+xAX9fReyeg@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-12-29  4:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-27  1:25 Alan Ruttenberg [this message]
2022-04-29  9:20 ` ob-lisp determining package Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFKQJ8=2ptR=7UFJOS8V1z=-cn3AbS3r2+b+faG+xAX9fReyeg@mail.gmail.com' \
    --to=alanruttenberg@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).