Chris Glur eas-lab@absamail.co.za writes:
[CG]
> > >> > I don't even KNOW about <completion>.
> > >>
[Chris Dollin]
> > >> It's whatever you have to type to do completion in the editor. I don't
> > >> have it, but it would be easy to implement in ved (pick a boring key
> > >> sequence, bind it to a function that looks left for a word, looks it
> > >> up in a completion table, and fills in the found template.)
> > >>
[CG]
> > > Yes I know WHAT completion means; just not that it's available for poplog
> > > ? If I've missed the availability of 'completion' for ved, imagine what
> > > else I've missed !
> >
[CD]
> > Of *course* it's "available"; you can extend Ved with user-defined code.
> > If you want it, you can have it.
It's not as trivial as you might think to produce a nice user interface.
Finding all the words in the current dictionary that start with a given
string is dead easy, using appdic or mapdic. E.g.
define words_start_with(item) -> list;
dlvars item;
sort(
mapdic(
procedure(word);
if isstartstring(item, word) then
word
endif
endprocedure
)
) -> list;
enddefine;
words_start_with('vedwordl') =>
** [vedwordleft vedwordleftdelete]
words_start_with('vedword') =>
** [vedwordleft vedwordleftdelete vedwordright vedwordrightdelete]
Some might find this (equivalent) version more readable:
define words_start_with(item) -> list;
dlvars item;
procedure(word);
if isstartstring(item, word) then
word
endif
endprocedure.mapdic.sort -> list;
enddefine;
However, designing a good user interface requires much more work
than that.
I recently played with converting the code for vedfilecomplete
(which offers you completions of file path names, invoked by
ESC 3, or ESC F) to do word completions, and the result is here:
http://www.cs.bham.ac.uk/research/poplog/auto/vedwordcomplete.p
If you compile that and then do
vedsetkey('\^[y', "vedwordcomplete");
then the sequence
ESC y
(which I think is not otherwise used in Ved) will use the contents
of the current pop11 dictionary to try to complete the word and if
there are alternatives will offer you a menu of options to choose from.
It works in Ved and XVed.
A major restriction: it works only for things that are already in the
dictionary, and does not include all the many autoloadable facilities
or libraries the user intends to compile but has not yet compiled
in the current editing session.
Neither does it use words you have already typed in the current file
to extend what is in the pop-11 dictionary.
Obviously both of those limitations could be overcome with a little
more programming, though, as usual, designing the interface to make
them convenient would take a little more work.
[CG]
> PS. the fact that facilities, like 'code folding/hiding' can be added
> incrementally, is further reason why it should be done - soon.
No: nobody has the time for this, and the people who really want it may
be able to benefit from what Dave Moss is doing to interface jedit
to pop11.
Many (but not all) of the reasons people think they need code folding
can be achieved by other means, e.g. this library defines the command
ENTER headers
which produces a list of procedure headers the current file:
http://www.cs.bham.ac.uk/research/poplog/auto/ved_headers.p
It also defines a command for using the list as an index.
Aaron
====
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk (ReadATas@please !)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/ (And free book on Philosophy of AI)
FREE TOOLS: http://www.cs.bham.ac.uk/research/poplog/freepoplog.html
|