home *** CD-ROM | disk | FTP | other *** search
/ Practical Programming in Tcl & Tk (4th Edition) / TCLBOOK4.BIN / pc / exsource / 29_3.tcl < prev    next >
Text File  |  2003-04-16  |  360b  |  19 lines

  1. #
  2. # Example 29-3
  3. # Emacs-like binding convention for Meta and Escape.
  4. #
  5.  
  6. proc BindSequence { w seq cmd } {
  7.     bind $w $seq $cmd
  8.     # Double-bind Meta-key and Escape-key
  9.     if [regexp {<Meta-(.*)>} $seq match letter] {
  10.         bind $w <Escape><$letter> $cmd
  11.     }
  12.     # Make leading keystroke harmless
  13.     if [regexp {(<.+>)<.+>} $seq match prefix] {
  14.         bind $w $prefix break
  15.     }
  16. }
  17.  
  18.  
  19.