Neil Madden | 25 Jun 23:55
Picon

Re: Why TCL interactive interpreter tries to auto-complete commands that were bound by the application to C functions?

Hi Yuri,

This list is for discussion of the development of Tcl itself. For  
general usage questions, try the comp.lang.tcl newsgroup. But see  
below for an answer to your question.

On 25 Jun 2008, at 20:53, Yuri wrote:
> I defined my own command 'g'.
> When this command is in a script file it's executed fine in a batch.
> But when I try to type it in interactive mode I get this:
>
> % g
> ambiguous command name "g": get gets glob global glut
>
>
> Why it does this and how do I disable this auto-completion?

The auto-completion is done by the unknown command mechanism in  
interactive mode. This is usually handled by a proc called ::unknown,  
so you can either redefine that or (in 8.5+) use [namespace unknown]  
to set it to a different command, e.g.

  proc HandleUnknown {name args} { error "invalid command name \"$name 
\"" }
  namespace unknown HandleUnknown

Be aware, though, that the default unknown handler does more than  
just auto-completion.

However, the unknown command handler is only called if a command with  
that exact name is not found, so in this case your "g" command seems  
not to have been loaded.

-- Neil

This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

Gmane