prompt-event and currnt context

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

prompt-event and currnt context

Post by newdep »

Hi Lutz,

How do i put the current contect name inside the (prompt-event?)
Seems its gone when using prompt-event..
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

There is no straight forward way to do this, as the prompt-event is defined in MAIN and calling it will always switch context to MAIN during its execution.

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

version 9.9.96 will pass it as a parameter:

Code: Select all

newLISP v.9.9.96 on OSX IPv4 UTF-8, execute 'newlisp -h' for more info.

> (prompt-event (eval (fn (ctx) (string ctx ":" (real-path) "$ "))))
$prompt-event
MAIN:/Users/lutz/newlisp-9.9.96$ (context 'FOO)
FOO
FOO:/Users/lutz/newlisp-9.9.96$ 
:)

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

Are you on "steroids" dies day? Man your quick with solutions ;-)
-- (define? (Cornflakes))

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

Some things are very quick to do. In this case it was only adding a parameter to a function call. All events (error-, signal-, prompt-, comand-, etc.) are handled by the same code, which already knows how to pass and handle parameters.

Locked