1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
elinks/contrib/lua/remote.lua
Petr Baudis 0f6d4310ad Initial commit of the HEAD branch of the ELinks CVS repository, as of
Thu Sep 15 15:57:07 CEST 2005. The previous history can be added to this
by grafting.
2005-09-15 15:58:31 +02:00

49 lines
1.2 KiB
Lua

-- ELinks-side part of elinks-remote
-- $Id: remote.lua,v 1.3 2005/03/27 22:59:41 miciah Exp $
-- See script elinks-remote for explanation what's this about.
----------------------------------------------------------------------
-- User options
----------------------------------------------------------------------
-- File to look in for external url to jump to
external_url_file = elinks_home.."/external.url"
----------------------------------------------------------------------
-- Implementation
----------------------------------------------------------------------
function external_url ()
fh = io.open (external_url_file, "r")
aline = current_url ()
if fh then
aline = read (fh, "*l")
io.close (fh)
else
print ("Couldn't open outfile")
end
return aline
end
bind_key ("main", "x",
function () return "goto_url", external_url () end)
function set_external_url ()
fh = io.open (external_url_file, "w")
aline = current_link ()
if fh then
write (fh, aline.."\n")
io.close (fh)
else
print ("Couldn't open outfile")
end
end
bind_key ("main", "X",
function () set_external_url () end)
-- vim: shiftwidth=4 softtabstop=4