[elinks-users] Elinks and Local Shell Links
fonseca at diku.dk
Sat Jan 7 12:44:29 PST 2006
Nigel Hamilton <nigel at turbo10.com> wrote Sat, Jan 07, 2006:
> Hi Jonas,
> Thanks for the prompt reply to my problem. PLease see below for
> one more question.
> >> Ideally I want to spawn off a new process based on a local link but
> >>parameterize the call (e.g, vi +115 HelloWorld.java) based on link
> >> I'm really impressed with elinks and hope to use it ... but this is
> >> the only snag? Any ideas on how I can achieve this with elinks. I
> >> would
> >>also like to run the compiler via elinks (e.g., javac HelloWorld.java).
> >> Any ideas?
> >It depends on how much of this JavaDoc-esque HTML you are in control of.
> >One problem is that if you specify an external handler, which seems to
> >be what you want, ELinks will create a copy of the local file in a temp
> >dir and you probably want to edit the file 'in place'. So if you can
> >create a small file for each link with a special extention and
> >containing the path to the file and the line to edit and then map that
> >extension to an external handler that will start vi or whatever you want
> >to do -- it could be a small shell script -- I think this could work.
> >This will also make it possible to have ELinks release it's control of
> >the terminal while your little shell script does it's thing.
> Cool. I do have full control of all the JavaDoc-esque files. So I
> could call a local CGI that produces output with a mime-type that invokes
> an external handler. I definitely want to stay inside the current
> terminal and you're right I would like to update the file in situ. But how
> would I pass the line number to the external handler? (e.g./usr/bin/vi
> +120 HelloWorld.java)?
> So if I had a local CGI
> (edit.cgi?line=129&program=HelloWorld.java) I could return a plain/text
> MIME type which invokes a
> /usr/bin/wrap_vi_to_overcome_tmp_file_problem_handler +120
> Is this how I could solve it? How could I pass parameters to the
Forget all about local CGI and stuff. I've found a simpler solution. And
good news, I just fixed ELinks so that it calls external handlers on the
file insitu. Hope you don't mind to use either git or wait for the
nightly snapshots to be build in 3 hours. Anyway, here is the setup.
You put this in ~/.mailcap (or you can use the option based MIME type
configuration, but that is too complex for me ;):
application/x-plugvi; plugvi %s; needsterminal
and the following in ~/.mime.types:
and I put the following in the plugvi script:
vi "$file" +"$line"
You probably want to also disable the mime.mailcap.ask option so that it
gets run when you follow the link.
Then you just make links like the following:
<a href="/path/to/file.c~11.plugvi">file.c line 11</a>
and it should work. :)
> Fingers crossed I can solve my problem ... without needing a new
> feature though ...
Well, one feature was needed but it was only a few lines, so...
More information about the elinks-users