[Openmcl-devel] Changing the REPL

Andrew Shalit alms at clozure.com
Sun Dec 2 19:34:25 PST 2007

To change the prompt, you can just redefine ccl::print-listener-prompt.

(in-package ccl)

(let ((*warn-if-redefine-kernel* nil))
   (defun print-listener-prompt (stream &optional (force t))
    (unless *quiet-flag*
     (when (or force (neq *break-level* *last-break-level*))
       (let* ((*listener-indent* nil))
         (fresh-line stream)
         (if (%izerop *break-level*)
           (%write-string ":-)" stream)   ; happy programming mode
           (format stream "~s >" *break-level*)))
       (write-string " " stream)
       (setq *last-break-level* *break-level*)))
     (force-output stream)))

Note: to figure this out, I brought up the Apropos window from the  
Tools menu, and looked for functions containing the word prompt.  I  
then did meta-point on the function to get to its source code.  (meta- 
point = option-period when the insertion point is in the symbol.  It's  
an unfortunate missing feature that you can't get to source code from  
the apropos window.)

I can't comment on readline, because I'm not familiar with it.  If I'm  
understanding what it is, though, you already have a lot of that built  
in to Clozure CL IDE.  Oh, wait: what platform are you running on?  If  
you're running the command line version, then yes, I can see why you'd  
want that.  The thing that most Lisp programmers these days are using,  
though, is an Emacs library called Slime.  YMMV.

Oh, and if you're not using the IDE, you should just call the CL  
function APROPOS rather than bringing up the GUI tool.  I'm not sure  
how to get to source code in the command-line version, sans Slime.

Happy hacking.


On Dec 2, 2007, at 7:55 PM, Duane Ryan wrote:

> Hi OpenMCL users.
> I'm a new lisp user, a transfer from ruby, and so far I love it; it  
> changes the way I program, and it is BLAZING fast. (especially  
> compared to, say, ruby or python).
> Still, one thing really annoys me: the repl. First of all, I'd like  
> to change the prompt. Minor thing, and I can always recompile my  
> customization easier (I'd just like a way to do that at runtime.)  
> Second, I want readline support. I know its license conflicts with  
> openmcl's, but what about editline? Heck, it's even built into os x!
> Anyway, I'd like to change that. So what I am doing at the moment is  
> spawning a new process whose io streams are controlled via two ptys,  
> and do read/editline support that way. But that seems such a large  
> hack, especially when I feel it could be so easily implemented. So,  
> short of implementing readline functionality, could the source be  
> modified so the user can?
> Thanks much, Duane.
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20071202/713ca4d1/attachment.htm>

More information about the Openmcl-devel mailing list