Tips

Open links in a new buffer with a one-key binding

In this example we use "d".

interactive("follow-new-buffer", function (I) {
    var target = OPEN_NEW_BUFFER;
    var element = yield I.read_browser_object("follow", "Follow", "links", target);
    browser_element_follow(I.buffer, target, element);
});
define_key(content_buffer_normal_keymap, "d", "follow-new-buffer");

It's possible to replace OPEN_NEW_BUFFER with OPEN_NEW_BUFFER_BACKGROUND. You might want to rename this alternative to "follow-new-buffer-background" and give it another key-sequence.

Keyboard shortcuts for often used websites

This example uses a user-defined function to setup shortcuts F1 and F2 that takes you directly to some specified webpage.

/**
 * Creates a keyboard-shortcut that takes you directly to a specified
 * URL. Creates a command in the process. (define_key only accepts
 * commands as actions). Can be used without specifying a key-sequence.
 */
function create_link_shortcut(cmdname, url, key) {
    interactive(cmdname, function (I) { I.buffer.load(url); });
    if(key != null) //only create shortcut if specified
        define_key(content_buffer_normal_keymap, key, cmdname);
}
create_link_shortcut("open-gmail", "http://gmail.com", "f1");
create_link_shortcut("open-progreddit", "http://programming.reddit.com", "f2");

Disable scroll bars

function disable_scrollbars (buffer) {
    buffer.browser.contentWindow.scrollbars.visible = false;
}
add_hook ("content_buffer_location_change_hook", disable_scrollbars);

Notes: Mouse scrollwheel won't work. Also, typeahead find is disrupted by lack of a scrollbar. This may or may not be fixable.

Launch Conkeror by default from Emacs

(setq browse-url-browser-function 'browse-url-generic
      browse-url-generic-program "/path/to/conkeror")

Select current buffer

Certain commands (like 'copy', 'save' etc.) prompt for a link and show hint numbers; when you just want to select the url of the current buffer, you can just type 0 get it. Let us say you want to save the current buffer, just type the following

M-x save RET 0 RET

and you will be prompted to choose a file path. With that, you could also duplicate buffers, which is a function found in many browsers:

M-x follow RET 0 RET

Note: This will not duplicate the state (like colum/line position etc.) of the buffer.

Tips (last edited 2008-07-09 18:23:57 by localhost)