[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Display greeting in REPL buffer before process starts
From: |
Jose A. Ortega Ruiz |
Subject: |
Re: Display greeting in REPL buffer before process starts |
Date: |
Sat, 20 Mar 2021 21:41:06 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi,
On Sat, Mar 20 2021, Dmitry Matveyev wrote:
> Hi, I'm trying to revive and improve Gerbil integration with Geiser.
That's great news, thanks!
> Gerbil's interpreter is run with `gxi -` with `-` being simultaneously
> "run in interactive mode" and "do not load init file". So I load file
> manually here:
> https://gitlab.com/greenfork/geiser-gerbil/-/blob/master/elisp/geiser-gerbil.el#L314
>
> But init file also shows a greeting message with `(displayln
> gerbil-greeting)` which is not displayed in Geiser. Could I get any
> suggestions on how to show this greeting message in REPL before prompt
> `>`?
When you use geiser-load-file (check its definition in
geiser-compile.el), any output from that command is parsed as an
evaluation response, and not displayed in the repl. If you want to
capture messages you could use the low-level geiser-eval--send/wait,
and process its result. Maybe Guile's startup function(s) will give you
an idea of how:
https://gitlab.com/emacs-geiser/guile/-/blob/master/geiser-guile.el#L379
there, guile is setting a variable, not loading anything, but the idea
would be the same: you specify a form to evaluate that loads the file
(the 'code'), use geiser-eval--send/wait, and parse its result (the
message will be under a key named "output")... that, however, won't
print that message in the REPL buffer by itself, you'd need to.
But i am thinking that a much easier way to do this might be simply to
invoke gxi with flags to the effect of loading the file you're
interested in. You can specify a 'binary' function that computes
them. The advantage is that, when calling the binary (with any flags),
stdout is still redirected to the REPL. See
https://gitlab.com/emacs-geiser/guile/-/blob/master/geiser-guile.el#L139
https://gitlab.com/emacs-geiser/guile/-/blob/master/geiser-guile.el#L430
(the value returned by the 'binary' method can be a list, instead of a
single string).
HTH,
jao
--
Art is the elimination of the unnecessary.
-Pablo Picasso, painter, and sculptor (1881-1973)