From: Giacomo Fiorin (giacomo.fiorin_at_gmail.com)
Date: Wed May 20 2020 - 11:09:16 CDT

Hi John, thanks for the clarification. For a proof of concept, yes, I
think that this implementation serves that initial purpose.

"info commands" returns standard Tcl commands, VMD-specific commands and
user-defined procs. Particularly the latter includes significant freedom,
so it should be sufficient to cover the vast majority of cases. In this
respect it may also be cleaner than rlwrap, which requires adding commands
explicitly via external files.

If you go ahead with it, it would be very helpful to have environment
variables for both linenoise and rlwrap, with some minimal documentation in
the User's Guide.

Giacomo

On Wed, May 20, 2020 at 11:33 AM John Stone <johns_at_ks.uiuc.edu> wrote:

> Giacomo,
> I realized I missed addressing your comment about there not
> being a persistent history:
> linenoise supports this, but I did not bother implementing the
> calls to commit commands to the the linenoise persisent history
> since Tcl has always had that built-in itself, albeit via "history".
> If people think that is important, it isn't difficult to add
> the calls to add to and commit the persistent history to disk.
>
> Best,
> John
>
> On Wed, May 20, 2020 at 10:26:21AM -0500, John Stone wrote:
> > Giacomo,
> > Thanks for the concrete feedback.
> > The tab completion feature for linenoise requires that the caller
> > (VMD) register a callback to be triggered any time the user presses
> > the completion key (tab, in this case). I haven't implemented
> > tab completion in the version of the code I sent you.
> >
> > To implement tab completion, I would likely use the Tcl command
> > "info commands" to get a list of all global Tcl commands, which would
> > include Tcl-intrinsic commands, VMD-internal commands, and VMD plugin
> > commands added to the global namespace. I could use that to provide
> > a large fraction of the completion candidates in an automatic way
> > without hard-coding a bunch of Tcl-specific stuff there.
> >
> > As with tab completion, I also didn't yet implement the "hint" callback
> > described in the linenoise README doc.
> >
> > The linenoise code appeals to me because of the BSD license
> > and minimalist implementation (3% of the size of GNU readline).
> >
> > Another more full-featured option would be the BSD libedit
> > library, which is apparently what Apple uses (along with a shim)
> > to emulate GNU readline (since they can't ship the real readline
> > lib due to GPL). I haven't looked at how clean/portable libedit is
> > outside of BSD OSes, but that might be another option for those
> > that expect a more featureful line editing implementation.
> >
> > The implementation I made for linenoise should serve as a proof of
> > concept for implementing support for any of the other line editing libs--00000000000053309905a616a079--