File: exmh-async.MASTER

package info (click to toggle)
exmh 1:2.9.0-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 4,216 kB
  • sloc: tcl: 38,046; perl: 1,647; makefile: 130; sh: 101; exp: 75; csh: 9; sed: 2
file content (31 lines) | stat: -rwxr-xr-x 850 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/wish -f
#
# async editor frontend for exmh
# Arg1: invoking interpreter's name (from [winfo name .])
# Arg2-end: editor command, including pathname
# LastArg: pathname of draft message
#

package require Tk
wm withdraw .

# simple argv cracking
set exmh [lindex $argv 0]
set editorCmd [lrange $argv 1 end]
set draftpath [lindex $argv [expr {[llength $argv] - 1}]]
set draftm [file tail $draftpath]

send $exmh [list Edit_Ident [winfo name .]]

# Used to do a split/join on $editorCmd to allow quoted -geom arguments.
# But that totally screws some arguments, like
# exmh-async gvim -c {cal SetSyn("mail")}
# other interesting cases are
# exmh-async xterm -geom +0+0 -e vi {+/^[-]*$}

if [catch {eval exec $editorCmd} err] {
    send $exmh [list Exmh_Status "exmh-async: editor failed: $err" purple]
}
send $exmh EditDialog $draftm

exit 0