add desktop/window-manager/notion-3
[unleashed-userland.git] / components / notion-3 / patches / lua-upgrade.patch
blobf1aa14d12cc8de040c7245c0df03c816fc786cc5
1 diff -ur notion-3-2014052800.mangled/contrib/scripts/simple_bindings.lua notion-3-2014052800/contrib/scripts/simple_bindings.lua
2 --- notion-3-2014052800.mangled/contrib/scripts/simple_bindings.lua 2014-05-27 18:00:18.000000000 -0400
3 +++ notion-3-2014052800/contrib/scripts/simple_bindings.lua 2014-08-04 03:54:53.380883374 -0400
4 @@ -54,7 +54,7 @@
5 if not ioncore then
6 ioncore = {get_paths = function() return {userdir="/home/deryni/.ion3"} end}
7 warn = print
8 - loadstring = function(str) return function() print(str) end end
9 + load = function(str) return function() print(str) end end
10 end
12 --}}} Standalone hacks
13 @@ -164,7 +164,7 @@
14 str = str.."\tkpress(\""..bind.keystr..[[", "]]..bind.bindstr.."\"),\n"
15 end
16 str = str.."})"
17 - loadstring(str)()
18 + load(str)()
19 end
21 -- vim: set expandtab sw=4:
22 diff -ur notion-3-2014052800.mangled/contrib/statusbar/statusbar_external.lua notion-3-2014052800/contrib/statusbar/statusbar_external.lua
23 --- notion-3-2014052800.mangled/contrib/statusbar/statusbar_external.lua 2014-05-27 18:00:18.000000000 -0400
24 +++ notion-3-2014052800/contrib/statusbar/statusbar_external.lua 2014-08-04 03:54:53.381313664 -0400
25 @@ -209,7 +209,7 @@
26 -- Start all
27 for key in pairs(statusbar_external) do
28 timers[key] = ioncore.create_timer()
29 - callbacks[key] = loadstring("start_execute("..key..")")
30 + callbacks[key] = load("start_execute("..key..")")
31 start_execute(key)
32 end
34 diff -ur notion-3-2014052800.mangled/contrib/statusd/legacy/statusd_sysmon.lua notion-3-2014052800/contrib/statusd/legacy/statusd_sysmon.lua
35 --- notion-3-2014052800.mangled/contrib/statusd/legacy/statusd_sysmon.lua 2014-05-27 18:00:18.000000000 -0400
36 +++ notion-3-2014052800/contrib/statusd/legacy/statusd_sysmon.lua 2014-08-04 03:54:53.381656408 -0400
37 @@ -185,7 +185,7 @@
38 return (metrics[arg1] or "")
39 end)
40 sysmon_st = string.gsub (sysmon_st, "%$%{(.-)%}", function (arg1)
41 - return loadstring("return "..arg1)()
42 + return load("return "..arg1)()
43 end)
44 -- replacing the '%%' macros with the '%' symbol
45 sysmon_st = string.gsub (sysmon_st, "%%%%", "%%")
46 diff -ur notion-3-2014052800.mangled/ioncore/ioncore_bindings.lua notion-3-2014052800/ioncore/ioncore_bindings.lua
47 --- notion-3-2014052800.mangled/ioncore/ioncore_bindings.lua 2014-05-27 18:00:18.000000000 -0400
48 +++ notion-3-2014052800/ioncore/ioncore_bindings.lua 2014-08-04 03:54:53.382014910 -0400
49 @@ -47,7 +47,7 @@
51 local gfncode="return function(_, _sub, _chld) "..guardcode.." return true end"
52 local gerr
53 - gfn, gerr=loadstring(gfncode, guardcode)
54 + gfn, gerr=load(gfncode, guardcode)
55 if not gfn then
56 ioncore.warn_traced(TR("Error compiling guard: %s", gerr))
57 end
58 @@ -69,7 +69,7 @@
59 if type(cmd)=="string" then
60 local fncode=("return function(_, _sub, _chld) local d = "
61 ..cmd.." end")
62 - local fn, err=loadstring(fncode, cmd)
63 + local fn, err=load(fncode, cmd)
64 if not fn then
65 ioncore.warn_traced(TR("Error in command string: ")..err)
66 return
67 diff -ur notion-3-2014052800.mangled/mod_query/mod_query.lua notion-3-2014052800/mod_query/mod_query.lua
68 --- notion-3-2014052800.mangled/mod_query/mod_query.lua 2014-05-27 18:00:18.000000000 -0400
69 +++ notion-3-2014052800/mod_query/mod_query.lua 2014-08-04 03:54:53.382604012 -0400
70 @@ -1048,7 +1048,7 @@
71 end
72 err=collect_errors(f)
73 else
74 - local f, err=loadstring(code)
75 + local f, err=load(code)
76 if not f then
77 mod_query.warn(mplex, err)
78 return
79 diff -ur notion-3-2014052800.mangled/mod_xinerama/mod_xinerama.lua notion-3-2014052800/mod_xinerama/mod_xinerama.lua
80 --- notion-3-2014052800.mangled/mod_xinerama/mod_xinerama.lua 2014-05-27 18:00:18.000000000 -0400
81 +++ notion-3-2014052800/mod_xinerama/mod_xinerama.lua 2014-08-04 04:24:22.371015820 -0400
82 @@ -138,6 +138,17 @@
83 return x_in and y_in
84 end
86 +-- table.maxn doesn't exist in lua 5.2
87 +local function table_maxn(t)
88 + local mn = 0
89 + for k, v in pairs(t) do
90 + if mn < k then
91 + mn = k
92 + end
93 + end
94 + return mn
95 +end
97 --DOC
98 -- Merges overlapping screens. I.e. it finds set of smallest rectangles,
99 -- such that these rectangles do not overlap and such that they contain
100 @@ -176,8 +187,8 @@
104 - if not pos then pos = table.maxn(ret)+1 end
105 - table.insert(ret, pos, newscreen)
106 + if not pos then pos = table_maxn(ret)+1 end
107 + ret[pos] = newscreen
109 fix_representations(ret)
110 return ret
111 @@ -276,7 +287,7 @@
113 -- pos keeps index of first set that we merged in this loop,
114 -- we want to insert the product of this merge to pos.
115 - if not pos then pos = table.maxn(screensets)+1 end
116 + if not pos then pos = table_maxn(screensets)+1 end
117 table.insert(screensets, pos, mergedset)