Skip to content

Instantly share code, notes, and snippets.

@Plaque-fcc
Created September 24, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Plaque-fcc/3777735 to your computer and use it in GitHub Desktop.
Save Plaque-fcc/3777735 to your computer and use it in GitHub Desktop.
Let Luakit.Introspector load arbitrary binding configs.
@@ -330,19 +330,19 @@ local function bind_tostring(b)
end
end
local source_lines = {}
local function function_source_range(func, info)
- local lines = source_lines[info.short_src]
+ local lines = source_lines[info.source]
if not lines then
- local source = lousy.load(info.short_src)
+ local source = lousy.load(info.source)
lines = {}
string.gsub(source, "([^\n]*)\n", function (line)
table.insert(lines, line)
end)
- source_lines[info.short_src] = lines
+ source_lines[info.source] = lines
end
return dedent(table.concat(lines, "\n", info.linedefined,
info.lastlinedefined), true)
end
@@ -357,16 +357,16 @@ export_funcs = {
local binds = {}
if mode.binds then
for i, b in pairs(mode.binds) do
local info = debug.getinfo(b.func, "uS")
-
+ info.source = info.source:sub(2)
binds[i] = {
type = b.type,
key = bind_tostring(b),
desc = b.desc and markdown(dedent(b.desc)) or nil,
- filename = info.short_src,
+ filename = info.source,
linedefined = info.linedefined,
lastlinedefined = info.lastlinedefined,
func = function_source_range(b.func, info),
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment