Subject: [sup-talk] keybinding to open link under cursor

From: Gabor Nyitrai <[email-masked]>
Date: Wed, 01 Feb 2012 08:53:38 +0000

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
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk