summarylogtreecommitdiffstats
path: root/snack-callbacks.patch
blob: 56c83fa1e2315b166ccbfa4b083a0e6cc75bc982 (plain)
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
--- src/app-wavesurfer/wavesurfer.tcl.orig	2018-09-08 17:44:19.358636647 +0200
+++ src/app-wavesurfer/wavesurfer.tcl	2018-09-08 17:47:50.028750684 +0200
@@ -2,6 +2,28 @@
 # the next line restarts using wish \
 exec wish "$0" "$@"
 
+# ----------------------------------------------------------
+# fix the wrong behaviour of snack callbacks for tcl >= 8.6
+if {[package vcompare $::tcl_patchLevel 8.6] >= 0} {
+    rename unknown _unknown
+    proc ::unknown {args} {
+        # If the command word has the form "namespace inscope ns cmd"
+        # then concatenate its arguments onto the end and evaluate it.
+    
+        set cmd [lindex $args 0]
+        if {[regexp "^:*namespace\[ \t\n\]+inscope" $cmd] && [llength $cmd] == 4} {
+            #return -code error "You need an {*}"
+            set arglist [lrange $args 1 end]
+            set ret [catch {uplevel 1 ::$cmd $arglist} result opts]
+            dict unset opts -errorinfo
+            dict incr opts -level
+            return -options $opts $result
+        }
+        uplevel 1 [list _unknown {*}$args]
+    }
+}
+# ----------------------------------------------------------
+
 set RELEASE 1.8.8p5
 set BUILD @BUILD@
 #