From: Paul Mackerras Date: Fri, 07 Nov 2008 11:50:03 GMT Subject: Re: [PATCH (GITK) v3 3/6] gitk: Add accelerators to frequently used menu commands. Message-ID: <18708.11115.293282.71076@cargo.ozlabs.ibm.com> In-Reply-To: <1225652389-22082-4-git-send-email-angavrilov@gmail.com> Alexander Gavrilov writes: > - eval $m add $params [lrange $i 4 end] > + set tail [lrange $i 4 end] > + regsub -all {\$M1T\y} $tail $M1T tail > + eval $m add $params $tail This is solving the problem that the $M1T doesn't get expanded in the call below because it's inside {}. If we are going to have a magic string that gets expanded like this, I'd rather it didn't look like a variable reference, because that is confusing. Alternatively, we could define a [meta] function that does this: proc meta {x} { if {[tk windowingsystem] eq "aqua"} { return Cmd-$x } return Ctrl-$x } and then use -accelerator [meta F5] in the makemenu call, and not have any magic string substitution in makemenu. That will work since the eval will evaluate the []. Paul.