······@msi.co.jp (Hisao Kuroda) writes:
> Is there similer way for CMU-CL ?
You can set EXT:*PROMPT* to either a string (which gets printed as is)
or a function (which gets called and should do the printing). I use
the following bit of code:
(defvar *last-prompt* nil)
(defvar *last-package* nil)
(defun promptify-package ()
(if (eq *last-package* *package*)
*last-prompt*
(let ((name (package-name *package*)))
(dolist (nickname (package-nicknames *package*))
(when (< (length nickname)
(length name))
(setf name nickname)))
(setf *last-package* *package*)
(setf *last-prompt*
(concatenate 'simple-string
(string-downcase name)
"> ")))))
(setf *prompt* #'promptify-package)
Caching the prompt string is probably overkill, but what the heck?
-William Lott
CMU Common Lisp Group
ps: a neato hack that can be used if your implementation only has a
*prompt* object that it just prints is to set that to a structure and
make the structure print function do whatever you want. You can do
all sorts of fun things with structure print functions if you have no
shame.