wish for console extention

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

wish for console extention

Post by newdep »

Hi Lutz,

Im missing something lazy ;-)
Actualy "Character/function Completion" on the console would be a wonder!

i.e.

> (diff <tab>
> (difference

or

> (print ti <tab>
> (print time


Is it a possible Feature request ? ;-)

Regards,

Norman.
-- (define? (Cornflakes))

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

Post by Lutz »

It works already for filenames, you could put a file each with a name of a function in the directory you are working in ;)

To integrate such a mechnism into newLISP would make it too bloated and dependent on additional libraries. But integrating this into the current newlisp-tk.tcl shell would be not too hard. The Tcl/Tk console already handles several special charcaters.

What would be even better is a newLISP special editor doing all of this and more (written in newLISP!?). But on my to-do list are other things more urgent, so I don't think this will happen soon, unless some body else does it?

Lutz

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post by Dmi »

Lutz!
Can newlisp console cmdline not to read directly from stdin, but call some newlisp function? (possible, two functions: one for read user command and one for write to console)

Then default function may be as simple as (read-line), but everyone will got ability to write more complex and flexible version.
Also, that will be very portable solution.
And will be great for scripting.

I think, if newlisp C-code will work such way, then many of us will do some useful (and public available) customisations.

...and we'll write new emacs ;-)))

P.S. I remember about lisps "read-eval-print"... But I'm not strong in lisp :-)
WBR, Dmi

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

Post by Lutz »

Input is already read from standard in and console output goes to standard out. When using the command line switches -p, -d or -x standard I/O gets redirected to the communications port. This current scenario gives maximum I/O speed and I don't want to burden with special functions processing input/output characters, trying to keep newLISP small and fast.

If somebody wants to improve the interactive command line a special shell could be written communicating with newLISP, i.e. the way the newlisp-tk shell works.

Most people use the interactive command-line only for small stuff and for debugging/testing and develop programs using an external editor.

How about writing a newLISP editor/shell right now? Norman showed us a while ago how to quickly interface with the curses libray. That should be enought to write an Emacs like editor ;)

Lutz

Dmi
Posts: 408
Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:

Post by Dmi »

I just seen the code in newlisp.c
Oh! I found readline here! I got it, and now it is fantastic :-)

But return to the code. I mean this loop
while(TRUE)...{
fgets(command,..., IOChannel)
executeCommandLine(command, OUT_CONSOLE,...
}
plus some stuff in executeCommandLine, debug etc.

I'm about modfying fgets into call to (read-user-input) or so.
And I think interactive loop is not a point of IO perf. degradation.
...And interactive debugging/testing is not so small amount of work when writing code.

But now - having readline, I'll be more fun with existing features.

About emacs... Really I have fun with vim ;-)
But shell... it's a point to think about.
WBR, Dmi

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post by HPW »

The Tcl Editor 'ASED Tcl/Tk IDE' has a nice completition feature:

http://www.tcl-home.de/ased/asedhome.htm

Maybe newLISP-TK can also use the cText-widget.
Hans-Peter

Locked