geiser-users
[Top][All Lists]
Advanced

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

Re: [Geiser-users] Using multiple REPLs from elisp


From: Jose A. Ortega Ruiz
Subject: Re: [Geiser-users] Using multiple REPLs from elisp
Date: Thu, 13 Dec 2012 04:18:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi Michael,

On Thu, Dec 13 2012, Michael Gauland wrote:

> I've been working on using geiser to support scheme in org-babel, and
> could use some advice. I've been successful and getting geiser to
> execute a code block, but run into trouble supporting mulitple
> sessions.
>
> In case you're not familiar with babel, it provides a mechanism to
> evaluate blocks of code within an org file. Each block can optionally
> specify a 'session' in which to be evaluated. This is more efficient,
> as the interpreter does not need to be re-started for every block, and
> also allows state to be preserved from one block to the next. Using
> multiple session names in one file is allowed.
>
> The first time a session is used, my implementation creates a REPL by
> calling 'run-geiser'. I rename the buffer based on the session name,
> and store the session name and buffer name in a hash.

When you create the REPL, Geiser already stores its buffer in a buffer
local variable of the source (org) file called geiser-repl--repl (see
below).

> The next time a session is used, I get the corresponding buffer from
> the hash, and try to execute the scheme block in that
> session. Unfortunately, I always seem to run in the last REPL that I
> created.
>
> I've tried a variety of approaches, mostly using 'switch-to-geiser',
> sometimes setting different 'geiser-repl...' variables first.

Geiser associates buffers to REPLs by setting a local variable in the
scheme buffer, geiser-repl--repl, so in principle it shouldn't be
necessary to maintain a separate table is that variable is set for the
buffer at hand.  When you do a switch-to-geiser from a scheme buffer,
that variable is set automatically, possibly after creating the REPL.

Afterwards, all evaluation commands defined in geiser-mode.el use that
variable to choose to which REPL the code is sent.  So, in principle, if
you call commands defined in geiser-mode.el (in the section ;;Evaluation
Commands) things should work out of the box without any additional
book-keeping on your side.

Thanks a lot for working on this: it'll be very nice to see Geiser
integrated in Babel!

Hope this helps,
jao
-- 
You err by thinking simplicity and elegance are mostly
cosmetic.  Simplicity and elegance are overwhelmingly
practical virtues.
  - William D Clinger, comp.lang.scheme



reply via email to

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