Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Gabor Nyitrai <iamthedata@gmail.com>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] keybinding to open link under cursor
Date: Tue, 31 Jan 2012 08:54:29 +0000	[thread overview]
Message-ID: <1327999544-sup-243@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... how do I this? I got this much:

# 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 =~ /http:\/\/[^ ]+/
        
        # 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-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


             reply	other threads:[~2012-01-31  9:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31  8:54 Gabor Nyitrai [this message]
2012-01-31 14:26 ` Alvaro Herrera
2012-02-01  3:16 ` Michael Stapelberg

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=1327999544-sup-243@haka \
    --to=iamthedata@gmail.com \
    --cc=sup-devel@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