35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
interp alias {} _ipexists loadinterp info exists
interp alias {} _ipset loadinterp set
interp alias {} _iparray loadinterp array
interp invokehidden loadinterp source $file
foreach arg $args {
upvar 1 $arg TheVar
if {[_iparray exists $arg]} {
foreach {key val} [_iparray get $arg] {
if {[info exists TheVar($key)]} {
set TheVar($key) $val
}
}
|
>
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
interp alias {} _ipexists loadinterp info exists
interp alias {} _ipset loadinterp set
interp alias {} _iparray loadinterp array
interp invokehidden loadinterp source $file
foreach arg $args {
##nagelfar vartype arg varName
upvar 1 $arg TheVar
if {[_iparray exists $arg]} {
foreach {key val} [_iparray get $arg] {
if {[info exists TheVar($key)]} {
set TheVar($key) $val
}
}
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# This is called when an editor is needed to display a file.
# It sets up the variable with the path, unless the var
# already exists.
proc pstools::locateEditor {globVar} {
upvar "#0" $globVar var
if {[info exists var]} return
# What is a good value on Mac?
if {$::tcl_platform(platform) == "unix"} {
set var emacs
} else {
set var wordpad
set dirs [glob -nocomplain c:/apps/emacs*]
lappend dirs {*}[glob -nocomplain "C:/Program Files/emacs*"]
foreach dir [lsort -decreasing -dictionary $dirs] {
set em [file join $dir bin runemacs.exe]
set em [file normalize $em]
if {[file exists $em]} {
set var $em
break
}
}
}
}
|
|
|
>
>
>
>
>
>
|
<
<
<
>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# This is called when an editor is needed to display a file.
# It sets up the variable with the path, unless the var
# already exists.
proc pstools::locateEditor {globVar} {
upvar "#0" $globVar var
if {[info exists var]} return
set candidates {}
if {[info exists ::env(EDITOR)]} {
lappend candidates $::env(EDITOR)
}
if {[info exists ::env(VISUAL)]} {
lappend candidates $::env(VISUAL)
}
if {$::tcl_platform(platform) == "windows"} {
# Try to locate some common installation points for Emacs
set dirs [glob -nocomplain c:/apps/emacs*]
lappend dirs {*}[glob -nocomplain "C:/Program Files/emacs*"]
foreach dir [lsort -decreasing -dictionary $dirs] {
set em [file join $dir bin runemacs.exe]
set em [file normalize $em]
if {[file exists $em]} {
lappend candidates $em
break
}
}
lappend candidates runemacs wordpad
}
# What is a good value on Mac?
# Add some more for fallback
lappend candidates emacs gedit kate vim
foreach cand $candidates {
if {[auto_execok $cand] ne ""} {
set var $cand
return
}
}
# If we fall through here we are kind of lost...
set var "could_not_find_editor"
}
|