Can one do this?
I want to preserve the REPL's history between invocations of CLISP.
Obviously, I'll have to be able to access the history in order to do
that, and I'd like it if there was a slightly easier option than
writing my own REPL.
> * Nathan Baum <···········@ogvagrearg.pbz> [2007-01-07 15:47:42 -0800]:
>
> Can one do this?
>
> I want to preserve the REPL's history between invocations of CLISP.
> Obviously, I'll have to be able to access the history in order to do
> that, and I'd like it if there was a slightly easier option than
> writing my own REPL.
you can use
http://clisp.cons.org/impnotes/readline-mod.html
and the usual readline facilities to save & retrieve REPL history.
--
Sam Steingold (http://sds.podval.org/) on Fedora Core release 6 (Zod)
http://ffii.org http://openvotingconsortium.org http://camera.org
http://jihadwatch.org http://thereligionofpeace.com
Don't use force -- get a bigger hammer.
Sam Steingold wrote:
> > * Nathan Baum <···········@ogvagrearg.pbz> [2007-01-07 15:47:42 -0800]:
> >
> > Can one do this?
> >
> > I want to preserve the REPL's history between invocations of CLISP.
> > Obviously, I'll have to be able to access the history in order to do
> > that, and I'd like it if there was a slightly easier option than
> > writing my own REPL.
>
> you can use
> http://clisp.cons.org/impnotes/readline-mod.html
> and the usual readline facilities to save & retrieve REPL history.
Huh. I assumed that wouldn't use the same history as CLISP.
;; .clisprc.lisp
(readline:read-history "~/.clisp.history")
(push (lambda () (readline:write-history "~/.clisp.history"))
*fini-hooks*)
Now I just need to find out how to stop it saying
;; Loading file /home/nbaum/.clisprc.lisp ...
;; Loaded file /home/nbaum/.clisprc.lisp
CLISP is far too noisy. :-P
Nathan Baum wrote:
> Sam Steingold wrote:
> > > * Nathan Baum <···········@ogvagrearg.pbz> [2007-01-07 15:47:42 -0800]:
> > >
> > > Can one do this?
> > >
> > > I want to preserve the REPL's history between invocations of CLISP.
> > > Obviously, I'll have to be able to access the history in order to do
> > > that, and I'd like it if there was a slightly easier option than
> > > writing my own REPL.
> >
> > you can use
> > http://clisp.cons.org/impnotes/readline-mod.html
> > and the usual readline facilities to save & retrieve REPL history.
>
> Huh. I assumed that wouldn't use the same history as CLISP.
>
> ;; .clisprc.lisp
> (readline:read-history "~/.clisp.history")
>
> (push (lambda () (readline:write-history "~/.clisp.history"))
> *fini-hooks*)
Hmm. Those functions don't expand ~. How delightful.
> Now I just need to find out how to stop it saying
>
> ;; Loading file /home/nbaum/.clisprc.lisp ...
> ;; Loaded file /home/nbaum/.clisprc.lisp
>
> CLISP is far too noisy. :-P
In fact, this is a deal breaker. If loading the RC generates output,
*lots* of Unix tools will break when I use them with CLISP scripts,
even if CLISP's obnoxious banner is disabled. This is a big
disincentive for using the RC in the first place. Why it can't use
stderr (or, better, not produce all this output when it's running
non-interactively), I can't fathom.
It works when I customize the image to automatically run it at startup,
though. So the problem is solved.
Nathan Baum wrote:
> Now I just need to find out how to stop it saying
>
> ;; Loading file /home/nbaum/.clisprc.lisp ...
> ;; Loaded file /home/nbaum/.clisprc.lisp
>
> CLISP is far too noisy. :-P
see *load-verbose*
http://www.lisp.org/HyperSpec/Body/fun_load.html
http://clisp.cons.org/impnotes/clisp.html#opt-verbose
http://clisp.cons.org/impnotes/system-dict.html#loadfile
Sam.
On 2007-01-07 18:47:42 -0500, "Nathan Baum" <···········@btinternet.com> said:
> Can one do this?
>
> I want to preserve the REPL's history between invocations of CLISP.
> Obviously, I'll have to be able to access the history in order to do
> that, and I'd like it if there was a slightly easier option than
> writing my own REPL.
Compile clisp without readline support. Then use rlwrap.
Novus
Novus wrote:
> On 2007-01-07 18:47:42 -0500, "Nathan Baum" <···········@btinternet.com> said:
>
> > Can one do this?
> >
> > I want to preserve the REPL's history between invocations of CLISP.
> > Obviously, I'll have to be able to access the history in order to do
> > that, and I'd like it if there was a slightly easier option than
> > writing my own REPL.
>
> Compile clisp without readline support. Then use rlwrap.
Excellent! I don't need it for CLISP any more, but it seems to work
great with SBCL.
> Novus
"Nathan Baum" <···········@btinternet.com> writes:
> Can one do this?
>
> I want to preserve the REPL's history between invocations of CLISP.
> Obviously, I'll have to be able to access the history in order to do
> that, and I'd like it if there was a slightly easier option than
> writing my own REPL.
AFAIK, you'll have to patch clisp to have it save and load readline
history.
From lisp, if you only want to keep the history you can use DRIBBLE,
but there's nothing to feed it back into readline history when you
restart clisp.
http://groups.google.com/group/comp.lang.lisp/msg/8b373bc571304a3b
Of course, writting your own REPL would allow you to write one that'd
work equally on all implementations, (but accessing to raw character
for line editing and history navigation like readline does would still
have to be done in an implementation dependant way).
--
__Pascal Bourguignon__ http://www.informatimago.com/
HEALTH WARNING: Care should be taken when lifting this product,
since its mass, and thus its weight, is dependent on its velocity
relative to the user.
Pascal Bourguignon wrote:
> "Nathan Baum" <···········@btinternet.com> writes:
>
>> Can one do this?
>>
>> I want to preserve the REPL's history between invocations of CLISP.
[snip!]
>
> AFAIK, you'll have to patch clisp to have it save and load readline
> history.
Wouldn't a possible solution be:
1. Use CLisp from (a buffer in) Emacs.
2. Save the contents of the relevant buffer, before quitting CLisp.
?
As for feeding bits and pieces of this history back into the REPL at
a later time, this should be a fairly simple matter of transferring
selected text from the buffer containing the (recorded) history,
to the buffer connected to the REPL.
Hope this helps.
-akr
Arne Knut Roev wrote:
> Pascal Bourguignon wrote:
> > "Nathan Baum" <···········@btinternet.com> writes:
> >
> >> Can one do this?
> >>
> >> I want to preserve the REPL's history between invocations of CLISP.
> [snip!]
> >
> > AFAIK, you'll have to patch clisp to have it save and load readline
> > history.
>
> Wouldn't a possible solution be:
>
> 1. Use CLisp from (a buffer in) Emacs.
> 2. Save the contents of the relevant buffer, before quitting CLisp.
> ?
It's a possible solution, but I don't use CLISP in Emacs. For that
matter, I hardly ever use external programs in Emacs; about the only
exceptions are a spell checker and whatever's on the end of SLIME
(usually, SBCL).
> As for feeding bits and pieces of this history back into the REPL at
> a later time, this should be a fairly simple matter of transferring
> selected text from the buffer containing the (recorded) history,
> to the buffer connected to the REPL.
That might work in Emacs, but obviously not outside of it. I could
probably pipe arbitrary input into the REPL, but that'd execute it.
Almost certainly not what I want.* It looks like I shall be making my
own REPL.**
* In this case, at least. I am interested in setting up a CLISP image
where the session is saved to that image at the end, so that it's
automatically persistent. The REPL issue would be solved by itself
there, but I don't want -all- my CLISP sessions to be persistent.
** Later. I don't need my history preserved -that- urgently.
> Hope this helps.
>
> -akr
"Nathan Baum" <···········@btinternet.com> writes:
> * In this case, at least. I am interested in setting up a CLISP image
> where the session is saved to that image at the end, so that it's
> automatically persistent. The REPL issue would be solved by itself
> there, but I don't want -all- my CLISP sessions to be persistent.
This is something else. Have a look at:
http://www.informatimago.com/develop/lisp/small-cl-pgms/ibcl/
that may be what you're looking for (some assembly required).
--
__Pascal Bourguignon__ http://www.informatimago.com/
ADVISORY: There is an extremely small but nonzero chance that,
through a process known as "tunneling," this product may
spontaneously disappear from its present location and reappear at
any random place in the universe, including your neighbor's
domicile. The manufacturer will not be responsible for any damages
or inconveniences that may result.
Pascal Bourguignon wrote:
> "Nathan Baum" <···········@btinternet.com> writes:
>
> > * In this case, at least. I am interested in setting up a CLISP image
> > where the session is saved to that image at the end, so that it's
> > automatically persistent. The REPL issue would be solved by itself
> > there, but I don't want -all- my CLISP sessions to be persistent.
>
> This is something else. Have a look at:
> http://www.informatimago.com/develop/lisp/small-cl-pgms/ibcl/
> that may be what you're looking for (some assembly required).
That looks cool. I hadn't thought about saving the source. Thanks!
Arne Knut Roev <······@runbox.com> writes:
> Pascal Bourguignon wrote:
>> "Nathan Baum" <···········@btinternet.com> writes:
>>
>>> Can one do this?
>>>
>>> I want to preserve the REPL's history between invocations of CLISP.
> [snip!]
>>
>> AFAIK, you'll have to patch clisp to have it save and load readline
>> history.
>
> Wouldn't a possible solution be:
>
> 1. Use CLisp from (a buffer in) Emacs.
> 2. Save the contents of the relevant buffer, before quitting CLisp.
> ?
>
> As for feeding bits and pieces of this history back into the REPL at
> a later time, this should be a fairly simple matter of transferring
> selected text from the buffer containing the (recorded) history,
> to the buffer connected to the REPL.
>
> Hope this helps.
If you don't use readline, but comint, you can of course instead fill
the comint-input-ring, which is what is used, not the contents of the
buffer. And yes, you'd have to do both, if you want the feature to
work both in the terminal and in emacs inferior-lisp.
--
__Pascal Bourguignon__ http://www.informatimago.com/
This is a signature virus. Add me to your signature and help me to live.