From: Gabor Nyitrai <iamthedata@gmail.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: [sup-talk] keybinding to open link under cursor
Date: Wed, 01 Feb 2012 08:53:38 +0000 [thread overview]
Message-ID: <1328086279-sup-9116@haka> (raw)
Hello,
I tried to add a keybinding hook to open a link that is on the current
line, but I got lost browsing the sup source... can you help how to do
this?
# keybindings.rb
modes['thread-view-mode'].keymap.add :open_link, "Open link on current line", "Y"
class Redwood::ThreadViewMode
def open_link
m = @message_lines[curpos] or return
## get the link from the current line somehow
# link = ...
## testing, just to see some response
BufferManager.flash "#{curpos}"
## testing, write content to a file to see what we've got
path = "/tmp/sup-temp.txt"
File.open(path, 'w') { |io| io.write m.raw_message }
## open a browser with the link as argument
# spawn "chromium-browser", link, [:in, :out, :err] => "/dev/null"
end
end
Thanks,
Gabor
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
reply other threads:[~2012-02-01 9:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328086279-sup-9116@haka \
--to=iamthedata@gmail.com \
--cc=sup-talk@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox