Version 3 of edprocs

Updated 2003-07-13 12:11:44

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) 
 #
 # ts 030713 ($Id: 1997,v 1.4 2003-07-14 08:00:15 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 }

 }

Category Command, a part of Tclx