[elinks-dev] Re: Use event system for keybinding.

Petr Baudis pasky at ucw.cz
Wed Oct 1 10:14:49 PDT 2003


Dear diary, on Wed, Oct 01, 2003 at 02:16:33PM CEST, I got a letter,
where Karsten Schölzel <kuser at gmx.de> told me, that...
> This patch uses my patch which adds a data pointer to event_handler and
> event_hook to make the key binding functionality available for other
> scripting backends.

Nice idea.

> Index: src/viewer/text/view.c
> ===================================================================
> --- src/viewer/text/view.c	(revision 356)
> +++ src/viewer/text/view.c	(revision 357)
> @@ -34,6 +34,7 @@
>  #include "protocol/http/auth.h"
>  #include "protocol/uri.h"
>  #include "sched/download.h"
> +#include "sched/event.h"
>  #include "sched/history.h"
>  #include "sched/location.h"
>  #include "sched/session.h"
> @@ -1067,9 +1068,9 @@
>  				dialog_lua_console(ses);
>  #endif
>  				goto x;
> -			case ACT_LUA_FUNCTION:
> -#ifdef HAVE_LUA
> -				run_lua_func(ses, func_ref);
> +			case ACT_SCRIPTING_FUNCTION:
> +#ifdef HAVE_SCRIPTING
> +				trigger_event(func_ref, ses);
>  #endif
>  				break;
>  			case ACT_QUIT:

It would be also nice to rename @func_ref to something more appropriate.
A separate patch would be fine.



BTW, the long term plan should probably be to do the same thing with
keybindings that with options and events, that is perparation to
distribution to specific modules. Lua will then be able to directly
register its own keybindings in a straightforward way. I don't think it
has a high priority now, though.

-- 
 
				Petr "Pasky" Baudis
.
To get something done, a committee should consist of no more than three
persons, two of them absent.
.
Stuff: http://pasky.ji.cz/



More information about the elinks-dev mailing list