community/pipermail-archives/sup-talk/2012-02.txt (1071B) - raw
1 From iamthedata@gmail.com Wed Feb 1 03:53:38 2012
2 From: iamthedata@gmail.com (Gabor Nyitrai)
3 Date: Wed, 01 Feb 2012 08:53:38 +0000
4 Subject: [sup-talk] keybinding to open link under cursor
5 Message-ID: <1328086279-sup-9116@haka>
6
7 Hello,
8
9 I tried to add a keybinding hook to open a link that is on the current
10 line, but I got lost browsing the sup source... can you help how to do
11 this?
12
13 # keybindings.rb
14
15 modes['thread-view-mode'].keymap.add :open_link, "Open link on current line", "Y"
16
17 class Redwood::ThreadViewMode
18 def open_link
19 m = @message_lines[curpos] or return
20
21 ## get the link from the current line somehow
22 # link = ...
23
24 ## testing, just to see some response
25 BufferManager.flash "#{curpos}"
26 ## testing, write content to a file to see what we've got
27 path = "/tmp/sup-temp.txt"
28 File.open(path, 'w') { |io| io.write m.raw_message }
29
30 ## open a browser with the link as argument
31 # spawn "chromium-browser", link, [:in, :out, :err] => "/dev/null"
32 end
33 end
34
35
36 Thanks,
37 Gabor
38