Updated 2013-08-15 01:37:03 by RLE

This command is part of the TclX package.
edprocs ?proc ...?

This procedure writes the named procedures, or all currently defined procedures, to a temporary file, then calls an editor on it (as specified by the EDITOR environment variable, or vi if none is specified), then sources the file back in if it was changed.
[TS] Use patch_edprocs_for_windows to make it working with WinXP.


 #
 # patches tclx edprocs for use with windows (XP) 
 #
 # todo: check for existence of /tmp/ and env(SystemRoot) 
 #
 # ts 030713 ($Id: 1997,v 1.7 2003-07-14 08:00:18 jcw Exp $)
 #
 proc patch_edprocs_for_windows {} {
    
    set edprocs [showproc edprocs]
    
    # default editor for windows is notepad instead of vi
    set newlines {
        if {[string compare $::tcl_platform(platform) "windows"] == 0} {
            set editor [file join $env(SystemRoot) notepad.exe]
        } else {
            set editor vi
        }
    }
    
    # do patch, insert new lines 
    regsub {set editor vi} $edprocs $newlines edprocs
    # use exec instead of system
    regsub {system "\$editor \$tmpFilename"} $edprocs {exec $editor $tmpFilename} edprocs
    
    # replace proc 
    eval $edprocs
    
    # create alias proc without ...s
    proc edproc {args} { eval edprocs $args }
    
 }