From: hyperstring.net ltd
Subject: Multiple server prompt sbcl
Date: 
Message-ID: <1163877278.035302.305760@m73g2000cwd.googlegroups.com>
HI All

Just something I thought you might find useful if you have mutiple
servers and ssh into them and use RAW sbcl without emacs to run lisp on
them, this changes the prompt from just * to

machine-name:package> e.g. pauls-laptop:CL-USER>

We just find it useful because we ssh in to our 3 servers from the
outside and if we get the wrong one and load the wrong file then we
could get into quite a mess!


(defvar *last-package* nil)
(defvar *cached-prompt* nil)

(defun package-prompt (stream)
  (unless (eq *last-package* *package*)
    (setf *cached-prompt*
          (concatenate 'string (machine-instance)
                                       ":"
                                      (or (first (package-nicknames
*package*))
                                   (package-name *package*))
                       "> "))
    (setf *last-package* *package*))
  (terpri)
  (princ *cached-prompt* stream))


(setf sb-int:*repl-prompt-fun* #'package-prompt)

Paul
http://www.hyperstring.net
From: KevinZzz
Subject: Re: Multiple server prompt sbcl
Date: 
Message-ID: <1163966767.064066.318140@m73g2000cwd.googlegroups.com>
hyperstring.net ltd wrote:
> HI All
>
> Just something I thought you might find useful if you have mutiple
> servers and ssh into them and use RAW sbcl without emacs to run lisp on
> them, this changes the prompt from just * to
>
> machine-name:package> e.g. pauls-laptop:CL-USER>
>
> We just find it useful because we ssh in to our 3 servers from the
> outside and if we get the wrong one and load the wrong file then we
> could get into quite a mess!
>
>
> (defvar *last-package* nil)
> (defvar *cached-prompt* nil)
>
> (defun package-prompt (stream)
>   (unless (eq *last-package* *package*)
>     (setf *cached-prompt*
>           (concatenate 'string (machine-instance)
>                                        ":"
>                                       (or (first (package-nicknames
> *package*))
>                                    (package-name *package*))
>                        "> "))
>     (setf *last-package* *package*))
>   (terpri)
>   (princ *cached-prompt* stream))
>
>
> (setf sb-int:*repl-prompt-fun* #'package-prompt)
>
> Paul
> http://www.hyperstring.net

Paul,

this is an extremely cool piece of code,

K