diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index eaf89059..378ba8fa 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -108,7 +108,7 @@ free_keybinding(struct keybinding *keybinding) } #ifdef CONFIG_SCRIPTING -/* TODO: unref function must be implemented. */ +/* TODO: unref function must be implemented. This is part of bug 810. */ /* if (keybinding->event != EVENT_NONE) scripting_unref(keybinding->event); */ #endif diff --git a/src/main/event.h b/src/main/event.h index 3ee7a03b..145b95a3 100644 --- a/src/main/event.h +++ b/src/main/event.h @@ -60,7 +60,8 @@ int register_event(unsigned char *name); /* This unregisters an event number @event, freeing the resources it * occupied, chain of associated hooks and unallocating the event id for - * further recyclation. */ + * further recyclation. + * Bug 810: unregister_event has not yet been implemented. */ int unregister_event(int event); int register_event_hook(int id, event_hook_T callback, int priority, void *data); diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 432581ec..59f62709 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -268,6 +268,7 @@ run_lua_func(va_list ap, void *data) return EVENT_HOOK_STATUS_NEXT; } +/* bind_key (keymap, keystroke, function) */ static int l_bind_key(LS) { @@ -284,6 +285,16 @@ l_bind_key(LS) if (!init_string(&event_name)) goto lua_error; + /* ELinks will need to call the Lua function when the user + * presses the key. However, ELinks cannot store a pointer + * to the function, because the C API of Lua does not provide + * one. Instead, ask the "reference system" of Lua to + * generate an integer key that ELinks can store. + * + * TODO: If l_bind_key() succeeds, then the function will + * never be removed from the reference system again, because + * the rest of ELinks does not tell this module if the + * keybinding is removed. This is part of bug 810. */ lua_pushvalue(S, 3); ref = luaL_ref(S, LUA_REGISTRYINDEX); add_format_to_string(&event_name, "lua-run-func %i", ref);