[mkcl-devel] Fwd: Add new alias command

Jean-Claude Beaudoin jean.claude.beaudoin at gmail.com
Thu Aug 25 22:43:15 UTC 2011


---------- Forwarded message ----------
From: Jean-Claude Beaudoin <jean.claude.beaudoin at gmail.com>
Date: Thu, Aug 25, 2011 at 5:28 PM
Subject: Re: [mkcl-devel] Add new alias command
To: Kaïraba Cissé <ckairaba at gmail.com>


Hello Kaïraba,

Using the old stand-alone REPL, are we?

Weren't you using SLIME instead lately? ;-)

Joke aside, I tried your piece of code in my .mkclrc and it works perfectly.
Here is exactly what I inserted:


(setf (cdar si::*tpl-commands*)
      (append (cdar si::*tpl-commands*)
      '(((:bye) quit :eval
       ":bye           Exit Lisp (a la Kairaba)"
       ":bye &eval &optional (status 0)        [Top level command]~@
    ~@
    Exit Lisp (Kairaba's way) without further confirmation.~%"))))


And here is what I get at the command line:

jean-claude at mars> mkcl-1.0.1
Loading ~/.mkclrc!
Done with loading asdf ~/.mkclrc!
Done with configuring asdf ~/.mkclrc!

This is ManKai Common Lisp 1.0.1

Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
Copyright (C) 2010-2011 Jean-Claude Beaudoin

ManKai Common Lisp (MKCL) is free software,
and you are welcome to redistribute and/or
modify it under the terms of the GNU LGPL.
See file 'Copyright' in the source code for details.

Type :h for Help.
Top level in: #<thread "Initial" (21173) 000000000291dd80>.
> :h

Top level commands:
:cf        Compile file.
:exit or ^D    Exit Lisp.
:ld        Load file.
:step        Single step form.
:tr(ace)    Trace function.
:untr(ace)    Untrace function.
:w(ho-)b(inds)  Show function invocations currently binding variable.
:bye           Exit Lisp (a la Kairaba).

Help commands:
:apropos    Apropos.
:doc(ument)    Document.
:h(elp) or ?    Help.  Type ":help help" for more information.
> :bye
jean-claude at mars>


So the :bye command shows up right where you wanted it and works as
expected.
I am then a bit at a loss trying to figure out what is going wrong on your
side.


On Thu, Aug 25, 2011 at 10:53 AM, Kaïraba Cissé <ckairaba at gmail.com> wrote:

> Hi jean-claude
> I wanted to add new aliases in mkcl.
> So, I add the following code in my .mkclrc file :
> *(setf (cdar si::*tpl-commands*)
>       (append (cdar si::*tpl-commands*) '(((:bye) quit :eval "" ""))))*
> Howerver, it doesn't work at all.
> I think the issue comes from the file mkcl-1.0.1/src/lsp/top.lsp on line
> 504.
> We must replace the line 504 by :
> *(&key ((:commands *tpl-commands*) *tpl-commands*)*
>
> What do you think about that ?
>
>
Well, this is debatable here but let me very clearly stress that
tpl-commands vs *tpl-commands* is not the source of your immediate concerns.
Your modification in .mkclrc of a sub-part of the commands list happens well
before the value of tpl-commands is sampled and it can be seen from either
variables.

Now, this aside, my thinking was that a call to "interactive-loop" without a
:commands argument would normally be done by "top-level" or something
equivalent to establish a new top-level REPL with a fresh context. This is
clearly different from the debugger or the inspector that need to establish
a sub-level with a sub-REPL of their own and its augmented set of commands
to serve their specialized purpose.

This matters of course only on recursive calls to "interactive-loop". With
the code as it stands now you have the choice between setting a clean slate
with a standard set of commands or keep on augmenting the inherited set of
commands. If the code is modified the way you suggest we get locked into
augmenting what we get from above and we lose the ability to easily reset to
a standard set of commands is lost.

If there is something that interferes with the customizability of the
initial command set by the user it is the use of "defconstant" for the
declaration of tpl-commands. It should most probably be replaced by
"defparameter" or "defvar".

Cheers,

Jean-Claude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/mkcl-devel/attachments/20110825/0bfb1a4a/attachment.html>


More information about the mkcl-devel mailing list