/standalone-inferior-picolisp

A standalone version of tj64's inferior-picolisp

Primary LanguageEmacs Lisp

Standalone inferior-picolisp

A standalone version of tj64’s inferior-picolisp

Intro

There are three versions of a picolisp mode for Emacs (AFAIK).

The newest, https://github.com/flexibeast/picolisp-mode, does not currently (as of June 2019) work with Org Babel src blocks using the :session parameter. (With no session, it seems to work OK.)

The older (well established among picolisp users of Emacs) variant of picolisp mode, https://github.com/tj64/picolisp-mode, does in fact work with src blocks with a session. That shouldn’t surprise us because its author is also the author of the Org Babel interface for picolisp (called ob-picolisp) that is shipped with Emacs proper. ob-picolisp relies on the inferior-picolisp module/feature which comes from tj64’s picolisp mode.

This issue with using flexibeast’s picolisp mode is that it doesn’t (currently) provide the inferior-picolisp feature (which as we’ve said, Org Babel via ob-picolisp is going to expect).

The “band-aid” solution which this repo offers is that we provide the inferior-picolisp feature that flexibeast’s picolisp mode would need for its users to be able to use Org Babel src block sessions. The enclosed version of inferior-picolisp.el is simply copied from tj64’s picolisp mode and then edited to remove things which were particular to tj64’s picolisp mode, so as to minimize (hopefully, eliminate) issues (like namespace pollution and symbol trouncing) with respect to flexibeast’s picolisp mode.

Install

Note, that this repo does not contain “a real package” so I’m not pushing this to MELPA (or anything like it); you have to clone this repo and then wire it into your Emacs runtime. It’s not difficult though.

Supposing that you put your third party non package.el tracked packages under $HOME/.emacs.d/extras — of course, if you put them somewhere else change the following accordingly — then:

$ mkdir -p $HOME/.emacs.d/extras
$ cd $HOME/.emacs.d/extras
$ git clone https://github.com/cryptorick/standalone-inferior-picolisp

Configure

I’m assuming that you are acquainted with Emacs configurations that use the use-package macro. (If not, crawl out from under your rock and RTFM to see what you’ve been missing out on. :)

In your Emacs init file, add these lines to your org mode setup.

;; Enable Org Babel for picolisp
(use-package ob-picolisp
  :init
  (use-package inferior-picolisp
    ;; git clone https://github.com/cryptorick/standalone-inferior-picolisp
    :load-path "~/.emacs.d/extras/standalone-inferior-picolisp"))

(Note the comment above with the git clone command — that is just to remind me where I got the package from (since it wasn’t sourced from MELPA, for instance).)

Caveat for the configure step

One caveat here is that ob-picolisp assumes that the pil script is on your PATH. If this is not the case, either put it somewhere on your PATH (I recommend this) or tweak the variable org-babel-picolisp-cmd in your setup — its value must be the full path of the pil script, as in the following example.

;; Enable Org Babel for picolisp
(use-package ob-picolisp
  :init
  (setq org-babel-picolisp-cmd "/path/on/your/host/to/pil")
  (use-package inferior-picolisp
    ;; git clone https://github.com/cryptorick/standalone-inferior-picolisp
    :load-path "~/.emacs.d/extras/standalone-inferior-picolisp"))

Afterward

You should be on your way to Babel-ing (“babbling” :) or literate programming with pil in Emacs.

This is a good time to reiterate that this rigmarole was only necessary to get flexibeast’s picolisp mode working with Org Babel with sessions. This rigmarole is not necessary if you use tj64’s picolisp mode.