Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] keybinding to open link under cursor
@ 2012-02-01  8:53 Gabor Nyitrai
  0 siblings, 0 replies; only message in thread
From: Gabor Nyitrai @ 2012-02-01  8:53 UTC (permalink / raw)
  To: sup-talk

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-02-01  9:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-01  8:53 [sup-talk] keybinding to open link under cursor Gabor Nyitrai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox