[elinks-dev] Make elinks realy scriptable.

Sébastien Dailly sebastien at chimrod.com
Sat Feb 11 05:00:28 PST 2012


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 « f », all links in the page becomes highlighted and labelled, like when you press « . » 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 number are updated for counting only the selected links).

Ok, that's easy : I just have to fetch all links on the current document, and each time the user enter a key in the message box, match the text with the link name for each link, and set the link as selected or not. I can do this 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…), but where is the api for the differents object (link, document) ? It seems it as not been written…

Ok, let's take a look in the code. Omg ! the functions described in the documentation 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… This is what you call a browser « highly customizable and can be extended via Lua or Guile scripts » ? Don't give me that jazz !

So, as it seems that anything as to be done, let's think about what I expect 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…)

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 scripts 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 elinks, and nobody notice that the documentation refers to scripts that are unusable now : is anybody using it ?
     * lua : I think it is a good choice : lightweight, and easy to code (as 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…

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…) because each user has differents need, and you can't think about every usage that will be made of a soft. I know it is a big modification, and will give a new face to elinks, and even if I'm not a C developper, and want to do 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 ?



More information about the elinks-dev mailing list