kumabook/bebop

Selection searches/webjumps a'la conkeror

Opened this issue · 0 comments

With following in my .conkerorrc i can type 'w' go to mini-buffer and type my wikipedia request there
(conkeror will also show me auto-completions, but i guess it's a lot harder to implement)...

function create_selection_search(webjump, key) {
interactive(webjump+"-selection-search",
"Search " + webjump + " with selection contents",
"find-url-new-buffer",
$browser_object = function (I) {
return webjump + " " + I.buffer.top_frame.getSelection();});
define_key(content_buffer_normal_keymap, key.toUpperCase(), webjump + "-selection-search");

interactive("prompted-"+webjump+"-search", null,
            function (I) {
                var term = yield I.minibuffer.read_url($prompt = "Search "+webjump+":",
                                                       $initial_value = webjump+" ",
                                                       $select = false);
                browser_object_follow(I.buffer, FOLLOW_DEFAULT, term);
            });
define_key(content_buffer_normal_keymap, key, "prompted-" + webjump + "-search");

}
// examples
create_selection_search("wikipedia","w");