From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Sep 06 2017 - 16:33:52 CDT

Hi,
  Tkcon contains an 'lremove' command that they apparently add to
the global namespace. Since Tkcon is only active when you're using a
GUI, you would need to define it for yourself when running in a text-only
mode. Here is a copy of what is included in the tkcon code:

## lremove - remove items from a list
# OPTS:
# -all remove all instances of each item
# -glob remove all instances matching glob pattern
# -regexp remove all instances matching regexp pattern
# ARGS: l a list to remove items from
# args items to remove (these are 'join'ed together)
##
proc lremove {args} {
    array set opts {-all 0 pattern -exact}
    while {[string match -* [lindex $args 0]]} {
        switch -glob -- [lindex $args 0] {
            -a* { set opts(-all) 1 }
            -g* { set opts(pattern) -glob }
            -r* { set opts(pattern) -regexp }
            -- { set args [lreplace $args 0 0]; break }
            default {return -code error "unknown option \"[lindex $args 0]\""}
        }
        set args [lreplace $args 0 0]
    }
    set l [lindex $args 0]
    foreach i [join [lreplace $args 0 0]] {
        if {[set ix [lsearch $opts(pattern) $l $i]] == -1} continue
        set l [lreplace $l $ix $ix]
        if {$opts(-all)} {
            while {[set ix [lsearch $opts(pattern) $l $i]] != -1} {
                set l [lreplace $l $ix $ix]
            }
        }
    }
    return $l
}

On Thu, Sep 07, 2017 at 02:38:44AM +0530, Devanand T wrote:
> Hi VMD users,
> I was able to use "lremove" command successfully from
> VMD Tk-console. But When I tried the same command using text mode it was
> not working. I got following message :
>
> invalid command name "lremove"
>
> I understand that "lremove" is not a default command in tcl. But I feel
> that this procedure is defined somewhere in the VMD installation folders.
> Should I load some specific package or so? Please help.
> TIA...
>
> --
> regards,
>
> *Devanand T*

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/