Make elinks realy scriptable.
Sébastien Dailly <[email protected]> Sat, 11 Feb 2012 14:00:28 +0100
| Newsgroups | gmane.comp.web.links |
|---|---|
| Message-ID | <[email protected]> |
Hello, I'm a long time user of elinks, and recently, I tried to build a lua=
script to add to elinks the same behavior than vimperator/pentadactyl hint=
mode :
You enter in the hint mode by pressing =AB f =BB, all links in the page bec=
omes highlighted and labelled, like when you press =AB . =BB in elinks for =
showing links number. Then you begin to type some letters on your keyboard =
: only the links with thoses char in the text become selected (the links nu=
mber are updated for counting only the selected links).
Ok, that's easy : I just have to fetch all links on the current document, a=
nd each time the user enter a key in the message box, match the text with t=
he link name for each link, and set the link as selected or not. I can do t=
his in lua !
Let's take a look in the lua api, there are some fonction described in the =
documentation, for interracting with elinks core (open a message box=85), b=
ut where is the api for the differents object (link, document) ? It seems i=
t as not been written=85
Ok, let's take a look in the code. Omg ! the functions described in the doc=
umentation are the only existing ones ! There is no way to get the document=
, no way to select a link, no way to jump to a link=85 This is what you cal=
l a browser =AB highly customizable and can be extended via Lua or Guile sc=
ripts =BB ? Don't give me that jazz !
So, as it seems that anything as to be done, let's think about what I expec=
t from a true scriptable browser :
Control the browser and the navigation :
* To be allowed to open a tab, close one
* Set the current url, refresh the page
* To be informed when the user select a link
=
Control the display :
* Access to the statusbar
* To be informed when the user press a key (even in a dialogbox)
* Change the color in the page (highlight text, css=85)
Control the document :
* Get the links in the document
* Select the current link
* Modify the document (not the text, the document)
* Fill forms
It's a big work to do, and I won't be able to do it for all the currents sc=
ripts languages provided in elinks; if I had to choose one :
=
* Guile : I have no experience with this language.
* Python : Althought I like python, I think it is to heavy for use it =
as a script interpreter.
* Perl : Don't make me laught !
* Javascript : Why not; but debian as removed the js support for elink=
s, and nobody notice that the documentation refers to scripts that are unus=
able now : is anybody using it ?
* lua : I think it is a good choice : lightweight, and easy to code (a=
s in the C code than the lua code)
=
Now we are in 2012, and lua allow objects, so we could give to the script a=
reflect of the elinks internal structs : document, link, form, session=85
The aim it is to give the user a maximum of control over the navigation. I =
appreciate to be able to script my applications as I want (vim, awesome=85)=
because each user has differents need, and you can't think about every usa=
ge that will be made of a soft. I know it is a big modification, and will g=
ive a new face to elinks, and even if I'm not a C developper, and want to d=
o it; elinks is not dead, console apps aren't apps from past, and elinks is=
the better web browser as complementary one !
Who's in ?