From: Eric Benson
Subject: Re: More informative prompt from Lucid CL
Date: 
Message-ID: <EB.92Apr3115152@watergate.lucid.com>
In article <····················@cs.cornell.edu> ·····@cs.cornell.edu (T. V. Raman) writes:

   From: ·····@cs.cornell.edu (T. V. Raman)
   Summary: How do I have lucid display the current package in the prompt?
   Date: 3 Apr 92 01:25:28 GMT

   How do I set up things so lucid shows the current package as part of
   the prompt?

This is unofficial, of course, but is likely to work in all Lucid
Common Lisp products available now and in the near future:

(defun lucid::prompt ()
  (format nil "~A> " (package-name *package*)))

From: Hisao Kuroda
Subject: Re: More informative prompt from Lucid CL
Date: 
Message-ID: <KURODA.92Apr14210823@orc.msi.co.jp>
In article <···············@watergate.lucid.com> ··@lucid.com (Eric Benson) writes:

 ;
 ;In article <····················@cs.cornell.edu> ·····@cs.cornell.edu (T. V. Raman) writes:
 ;
 ;
 ;   How do I set up things so lucid shows the current package as part of
 ;   the prompt?
 ;
 ;This is unofficial, of course, but is likely to work in all Lucid
 ;Common Lisp products available now and in the near future:
 ;
 ;(defun lucid::prompt ()
 ;  (format nil "~A> " (package-name *package*)))

Is there similer way for CMU-CL ?

thank you
--

Mathmatical Systems Institute Inc.			Hisao Kuroda
6F AM BLDG. 2-5-3 Shinjuku, Shinjuku-Ku			301, 1-22-2 Kyonan-cho
Tokyo, Japan 160					Musashino-shi,
E-mail : ······@msi.co.jp (Kuroda,Hisao)		Tokyo, Japan 180

    Everybody's got something to hide exept me and my //GS.
From: ············@cs.cmu.edu
Subject: Re: More informative prompt from Lucid CL
Date: 
Message-ID: <gdupq2G00jeiFHQ=ok@cs.cmu.edu>
······@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.
From: Frank Yellin
Subject: Re: More informative prompt from Lucid CL
Date: 
Message-ID: <FY.92Apr15163217@hardwick.lucid.com>
FCC: ~fy/outmail.hold


In article <··················@cs.cmu.edu> ············@cs.cmu.edu writes:
>  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.

Wow!  Wonderful!  One of the best hacks I've seen in a while.

   (defstruct (prompt-hack (:print-function do-prompt)))
   (defun do-prompt (struct stream level) 
      (format stream "~A> " (package-name *package*)))
   (setq *prompt* (make-prompt-hack))

works in Lucid Common Lisp.  


-- Frank Yellin
   ··@lucid.com