sleepomeno’s conkerorrc.org ivoarch’s conkerorr.org Goto Tab Babbage Files Conkeror Jan 2011 Blog Emacs-Fu Dec 2010 Conkeror Blog Programming Conkeror ConkerorWiki Conkeror Tips
Stack Exchange Org Tangle Source Question Using Emacs org-mode babel to tangle the source blocks and create a javascript file.
Run C-c C-c on the #+KEYWORD to trigger scanning of the buffer special code blocks and updating the information. i.e. once must run it on the line with #+PROPERTY: tangle key-word to refresh local setup.
Finally tangle the entire file with C-c C-v t
Default debugging test to ensure everything
dumpln("hello, world!");
Will need to have this automated eventually, or rather must finalize Raspberry Pi Remote Proxy Ham, or use Proxy PAC File
// proxy_server_default = "proxy.name.com";
// proxy_port_default = 80;
kmicu from the IRC #conkeror channel
user_pref("javascript.options.showInConsole", false);
user_pref("devtools.errorconsole.deprecation_warnings", false);
user_pref("datareporting.healthreport.logging.consoleEnabled", false);
// user_pref("datareporting.healthreport.logging.consoleLevel", "Warn");
user_pref("datareporting.healthreport.logging.consoleLevel", "Error");
// user_pref("datareporting.healthreport.logging.dumpLevel", "Debug");
user_pref("browser.dom.window.dump.enabled", false);
user_pref("javascript.options.strict", false);
user_pref("extensions.logging.enabled", false);
user_pref("services.sync.log.logger.addonutils", "Error");
user_pref("services.sync.log.logger.engine.addons", "Error");
Allow for contrib stuff
var themes = "~/.conkerorrc/theme";
load_paths.unshift("chrome://conkeror-contrib/content");
theme_load_paths.unshift(themes);
theme_unload("default");
theme_load("conkeror-theme-zenburn");
// Learn something new everyday
homepage = "http://en.wikipedia.org/wiki/Special:Random";
When opening URLs from GNU Emacs, open them in new buffer. And open new buffers in the background
require ("new-tabs.js");
require ("clicks-in-new-buffer.js");
url_remoting_fn = load_url_in_new_buffer;
Enable auto save session and make it load automatically on startup.
require("session.js");
session_auto_save_auto_load = true;
session_pref('browser.history_expire_days', 60);
Use keypass instead
// This is the default anyway
//session_pref("signon.rememberSignons", false);
Disable clock widget, and enable all others
require("mode-line.js");
remove_hook("mode_line_hook", mode_line_adder(clock_widget));
add_hook("mode_line_hook", mode_line_adder(buffer_icon_widget), true);
add_hook("mode_line_hook", mode_line_adder(current_buffer_name_widget), true);
add_hook("mode_line_hook", mode_line_adder(loading_count_widget), true);
add_hook("mode_line_hook", mode_line_adder(buffer_count_widget), true);
add_hook("mode_line_hook", mode_line_adder(zoom_widget));
add_hook("mode_line_hook", mode_line_adder(downloads_status_widget));
Activate the favicon widget within the modeline, for displaying favicons anywhere
require("favicon.js");
add_hook("mode_line_hook", mode_line_adder(buffer_icon_widget), true);
read_buffer_show_icons = true;
Hinting number associated with follow command. Number 0 refers to current URL. And hints-quote-next permits entry of number character as search refinement text.
c 0 | copy the current URL |
C-u f 0 | open background buffer with the current URL |
x 0 | open current document with an external program |
C-q “num” | hints-quote-next |
Display the URL of a link in hints mode as well as any information about the currently selected link. Uncomment the line below to enable home-row letters as hint digits
hints_display_url_panel = true;
hints_minibuffer_annotation_mode(true);
//hint_digits="asdfghjkl";
function my_zoom_set (buffer) {
browser_zoom_set(buffer, true, 150);
browser_zoom_set(buffer, false, 100);
}
add_hook('create_buffer_late_hook', my_zoom_set);
The following settings are for Handling Downloads, Torrent Files and Various Mime Types in Conkeror
Set the default download directory and don’t use a new window for downloads
cwd = get_home_directory();
cwd.append("Downloads");
download_buffer_automatic_open_target=OPEN_NEW_BUFFER_BACKGROUND;
To stop a download buffer from ever opening automatically, uncomment the following
remove_hook("download_added_hook", open_download_buffer_automatically);
interactive(
"ekr_cmd_copy",
"Copy the selection to the clipboard and the Emacs kill ring",
function (I) {
call_interactively(I, "cmd_copy")
var cc = read_from_x_primary_selection();
cc = cc.replace(/([^\\]*)\\([^\\]*)/g, "$1\\\\$2");
cc = cc.replace('"', '\\"', "g");
cc = cc.replace("'", "'\\''", "g");
var ecc = "emacsclient -e '(kill-new \"" + cc + "\")' > /dev/null";
shell_command_blind(ecc);
}
);
undefine_key(caret_keymap,"M-w");
define_key(caret_keymap,"M-w", "ekr_cmd_copy");
undefine_key(content_buffer_normal_keymap,"M-w");
define_key(content_buffer_normal_keymap,"M-w", "ekr_cmd_copy");
undefine_key(special_buffer_keymap,"M-w");
define_key(special_buffer_keymap,"M-w", "ekr_cmd_copy");
undefine_key(text_keymap,"M-w");
define_key(text_keymap,"M-w", "ekr_cmd_copy");
orgmode.org org-protocol, emacs-fu, puntoblogspot(well-after-month-of-no-activity-in-this) oremacs my
Connect to the existing Emacs session when view source code
// editor_shell_command = "emacsclient -c -a emacs";
editor_shell_command = "emacsclient -c -a \"\"";
view_source_use_external_editor = true;
// org-protocol
// simplified, neater wrapper function
function org_capture_wrapper (url, title, selection, window, cmd_str) {
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture (url, title, selection, window) {
var cmd_str =
'emacsclient \"org-protocol://capture:/w/'+url+'/'+title+'/'+selection+'\"';
org_capture_wrapper(url,title,selection,window,cmd_str);
}
function org_store_link (url, title, window) {
var cmd_str =
'emacsclient \"org-protocol:/store-link:/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_journal (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/j/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_kaizen (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/k/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_emacs (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/e/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_devenv (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/d/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_code (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/p/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_course (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/c/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
function org_capture_monopoly (url, title, selection, window) {
var cmd_str = 'emacsclient \"org-protocol://capture:/m/'+url+'/'+title+'\"';
if (window != null) {
window.minibuffer.message('Issuing ' + cmd_str);
}
shell_command_blind(cmd_str);
}
interactive("org-capture", "Clip URL, title and selection to capture via org-protocol",
function (I) {
org_capture(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-store-link", "Stores [[url][title]] as org link and copies url to emacs kill ring",
function (I) {
org_store_link(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
I.window);
});
interactive("org-capture-journal", "Journal",
function (I) {
org_capture_journal(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-capture-kaizen", "Kaizen - Self Enlightenment",
function (I) {
org_capture_kaizen(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-capture-emacs", "Emacs",
function (I) {
org_capture_emacs(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-capture-devenv", "Development Environment",
function (I) {
org_capture_devenv(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-capture-code", "Programming and Code",
function (I) {
org_capture_code(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-capture-course", "Chow Course",
function (I) {
org_capture_course(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
interactive("org-capture-monopoly", "Monopolize the 1%",
function (I) {
org_capture_monopoly(encodeURIComponent(I.buffer.display_uri_string),
encodeURIComponent(I.buffer.document.title),
encodeURIComponent(I.buffer.top_frame.getSelection()),
I.window);
});
content_handlers.set("application/pdf", content_handler_open_default_viewer);
external_content_handlers.set("application/pdf", "evince");
external_content_handlers.set(
"application/vnd.ms-excel",
"libreoffice"
);
external_content_handlers.set(
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"libreoffice"
);
external_content_handlers.set(
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"libreoffice"
);
external_content_handlers.set(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"libreoffice"
);
//set_protocol_handler("magnet", find_file_in_path("deluge-gtk"));
//content_handlers.set("application/x-bittorrent", content_handler_open);
//external_content_handlers.set("application/x-bittorrent", "deluge-gtk");
content_handlers.set("application/x-bittorrent", content_handler_save);
set_protocol_handler("mailto", make_file("~/bin/handle-mailto"));
Disable extension compatibility checking, Allow installation of extensions from any source and Enable security updates
session_pref('extensions.checkCompatibility', false);
session_pref("xpinstall.whitelist.required", false);
user_pref("extensions.checkUpdateSecurity", true);
/*define_variable("firebug_url",
"http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");*/
define_variable("firebug_url",
"http://getfirebug.com/releases/lite/1.4/firebug-lite.js");
function firebug (I) {
var doc = I.buffer.document;
var script = doc.createElement('script');
script.setAttribute('type', 'text/javascript');
script.setAttribute('type', firebug_url);
script.setAttribute('type', 'firebug.init();');
doc.body.appendChild(script);
}
interactive("firebug", "open firebug lite", firebug);
if ('@eff.org/https-everywhere;1' in Cc) {
interactive("https-everywhere-options-dialog",
"Open the HTTPS Everywhere options dialog.",
function (I) {
window_watcher.openWindow(
null, "chrome://https-everywhere/content/preferences.xul",
"","chrome,titlebar,toolbar,centerscreen,resizable",null);
});
}
require("adblockplus");
require("reddit");
require("gmail");
require("feedly");
require("twitter");
Needs the sqlitemanager xpi installed
interactive("sqlite-manager",
"Open SQLite Manager window.",
function (I) {
make_chrome_window('chrome://SQLiteManager/content/sqlitemanager.xul');
});
- NEED TO TEST MODE ACTIVATION *
Bookmarks and Smartlinks can be navigated using g, for by the short string representing the webjump. In addition, SmartLinks can be suffix with additional string parameters that are passed to the webjump URL string with the %s parameter replaced by the string.
Use completion system for - bookmarks, webjumps and the minibuffer. Separate functions to call history url completion
url_completion_use_history = false;
url_completion_use_bookmarks = true;
url_completion_use_webjumps = true;
minibuffer_auto_complete_default = true;
Separate history from webjumps and bookmarks. h and H are used to find a URL from history in current buffer and in a new buffer respectively.
define_browser_object_class(
"history-url", null,
function (I, prompt) {
check_buffer (I.buffer, content_buffer);
var result = yield I.buffer.window.minibuffer.read_url(
$prompt = prompt, $use_webjumps = false, $use_history = true, $use_bookmarks = false);
yield co_return (result);
});
interactive("find-url-from-history",
"Find a page from history in the current buffer",
"find-url",
$browser_object = browser_object_history_url);
interactive("find-url-from-history-new-buffer",
"Find a page from history in a new buffer",
"find-url-new-buffer",
$browser_object = browser_object_history_url);
define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer");
define_key(content_buffer_normal_keymap, "H", "find-url-from-history");
Make duckduckgo webjump the default action
read_url_handler_list = [read_url_make_default_webjump_handler("duckduckgo")];
define_webjump("mikrotik", "http://192.168.88.1");
define_webjump("netgear", "http://192.168.88.2");
Will need to add scopius / journal search entry Use V to vote on questions on StackExchange, StackOVerflow, ServerFault, SuperUser, etc
define_webjump("linux-questions","http://www.linuxquestions.org/questions/");
define_webjump("gmane", "http://gmane.org/find.php?list=%s");
// define_webjump("gwene", "http://gwene.org/",
// $post_data = [['name', 'url'], ['value', '%s']],
// $alternative = "http://gwene.org");
define_webjump("gwene",
function (term) {
return load_spec(
{ uri: "http://gwene.org/",
post_data: make_post_data([['url', term]]) });
},
$alternative = "http://gwene.org");
define_webjump("hackernews", "http://searchyc.com/%s", $alternative = "http://news.ycombinator.com/");
define_webjump("slashdot", "http://slashdot.org/search.pl?query=%s");
define_webjump("stackexchange", "http://stackexchange.com/search?q=%s", $alternative = "http://stackexchange.com/");
define_webjump("stackoverflow", "http://stackoverflow.com/search?q=%s", $alternative = "http://stackoverflow.com/");
define_webjump("superuser", "http://superuser.com/search?q=%s", $alternative = "http://superuser.com/");
// free eBooks
define_webjump("gutenberg",
function (term) {
return load_spec(
{ uri: "http://www.gutenberg.org/ebooks/search/",
post_data: make_post_data([['query', term]]) });
},
$alternative = "http://www.gutenberg.org/");
See reddit mode Provides reddit mode cursor
Binding | Reddit_Keymap | Description |
---|---|---|
j | reddit-next | Move cursor to next reddit entry or comment |
J | reddit-next-parent-comment | |
k | reddit-prev | |
K | reddit-prev-parent-comment | |
h | reddit-open-comments | |
, | reddit-vote-up | |
. | reddit-vote-down |
define_webjump("reddit", "http://www.reddit.com/search?q=%s", $alternative = "http://www.reddit.com/");
define_webjump("reddit/subreddit", "http://www.reddit.com/r/%s");
define_webjump("stackexchange/linux", "http://unix.stackexchange.com/search?q=%s", $alternative="http://unix.stackexchange.com");
define_webjump("arch/forums", "http://bbs.archlinux.org");
define_webjump("arch/wiki", "http://wiki.archlinux.org/index.php?search=%s");
define_webjump("arch/aur", "http://aur.archlinux.org/packages.php?O=0&K=%s");
define_webjump("arch/packages",
"https://www.archlinux.org/packages/?sort=&q=%s&limit=50",
$alternative="https://packages.archlinux.org");
define_webjump("distrowatch", "http://distrowatch.com/table.php?distribution=%s");
define_webjump("emacswiki", "https://www.emacswiki.org/search?q=%s", $alternative="https://www.emacswiki.org/");
define_webjump("marmalade", "http://marmalade-repo.org/packages?q=%s");
Use github-mode to install fallthrough bindings for github’s keyboard shortcuts as well as the following:
Binding | Description |
---|---|
? | github-keyboard-shortcuts |
s | github-focus-site-search |
/ | github-focus-issues-search |
//require("github");
define_webjump("github", "http://github.com/search?q=%s&type=Everything");
define_webjump("bashfaq", "http://mywiki.wooledge.org/BashFAQ?action=fullsearch&context=180&value=%s&fullsearch=Text",
$alternative = "http://mywiki.wooledge.org/BashFAQ");
define_webjump("cmdlinefu",
function(term) {
return 'http://www.commandlinefu.com/commands/matching/' +
term.replace(/[^a-zA-Z0-9_\-]/g, '')
.replace(/[\s\-]+/g, '-') +
'/' + btoa(term);
},
$alternative = "http://www.commandlinefu.com/");
define_webjump("clhs",
"http://www.xach.com/clhs?q=%s",
$alternative = "http://www.lispworks.com/documentation/HyperSpec/Front/index.htm");
define_webjump("cliki", "http://www.cliki.net/admin/search?words=%s");
define_webjump("perldoc", "http://perldoc.perl.org/search.html?q=%s");
define_webjump("cpan", "http://search.cpan.org/search?query=%s&mode=all");
define_webjump("metacpan", "https://metacpan.org/search?q=%s");
define_webjump("python", "http://docs.python.org/search.html?q=%s");
define_webjump("python3", "http://docs.python.org/py3k/search.html?q=%s");
define_webjump("ctan/desc", "http://www.ctan.org/search/?search=%s&search_type=description");
define_webjump("ctan/file", "http://www.ctan.org/search/?search=%s&search_type=filename");
define_webjump("ctan/pack", "http://www.ctan.org/search/?search=%s&search_type=id");
define_webjump("ctan", "http://www.ctan.org/search/?search=%s&search_type=description&search_type=filename&search_type=id");
define_webjump("stackexchange/tex", "http://tex.stackexchange.com/search?q=%s", $alternative="http://tex.stackexchange.com");
//require("google-maps");
//require("page-modes/google-maps.js");
define_webjump("google/za", "http://www.google.co.za/webhp?#q=%s&tbs=ctr:countryZA&cr=countryZA", $alternative="http://www.google.co.za/");
define_webjump("image", "http://www.google.com/images?q=%s&safe=off", $alternative = "http://www.google.com/imghp?as_q=&safe=off");
define_webjump("1337x", "https://www.1337x.to/srch?search=%s");
require("page-modes/wikipedia.js");
//wikipedia_webjumps_format = "wp-%s"; // controls the webjump names. default "wikipedia-%s"
define_wikipedia_webjumps("en"); // For English
//require("wikipedia-didyoumean");
define_webjump("fnb", "https://www.fnb.co.za");
define_webjump("amazon", "https://www.amazon.com/s/?url=search-alias%3Daps&field-keywords=%s", $alternative = "https://www.amazon.com/");
require("xkcd");
xkcd_add_title = true;
define_webjump("youtube", "http://www.youtube.com/results?search_query=%s&search=Search");
define_webjump("wordpress", "http://wordpress.org/search/%s");
var unused_webjumps = ['answers', 'creativecommons', 'lucky', 'yahoo'];
for (var i=0; i<unused_webjumps.length; i++) {
delete webjumps[unused_webjumps[i]];
}
key_bindings_ignore_capslock = true;
undefine_key(content_buffer_normal_keymap, "up", "cmd_scrollLineUp");
undefine_key(content_buffer_normal_keymap, "down", "cmd_scrollLineDown");
undefine_key(content_buffer_normal_keymap, "left", "cmd_scrollLeft");
undefine_key(content_buffer_normal_keymap, "right", "cmd_scrollRight");
Make “l” open link in buffer background, and “M-f” and “M-b” are next and previous buffer respectively.
//define_key(content_buffer_normal_keymap, "C-u f", "follow-new-buffer-background");
undefine_key(content_buffer_normal_keymap, "l", "back");
define_key(content_buffer_normal_keymap, "l", "follow-new-buffer-background");
define_key(content_buffer_normal_keymap, "M-f", "buffer-next");
define_key(content_buffer_normal_keymap, "M-b", "buffer-previous");
function define_switch_buffer_key (key, buf_num) {
define_key(default_global_keymap, key,
function (I) {
switch_to_buffer(I.window,
I.window.buffers.get_buffer(buf_num));
});
}
for (let i = 0; i < 10; ++i) {
define_switch_buffer_key(String((i+1)%10), i);
}
Mechanism by which Conkeror can automatically perform a defined redirection on configured urls and url patterns. I.e. used to ”skip” intermediary webpages when browsing and go straight to the content you want
require("client-redirect");
define_client_redirect(name, transform…); name - string naming redirect transform… - may be function or RegEx
Skips “/imgres” page at Google Images
define_client_redirect("google-images",
function (uri) {
return /(images|www)\.google\.com$/.test(uri.host)
&& uri.filePath == "/imgres"
&& regexp_exec(/imgurl=([^&]+)/, uri.query, 1);
});
define_client_redirect("imgur",
build_url_regexp($domain = "imgur", $path = /.*/),
function (m) {
return m[0].replace("//", "//i.")+".jpg";
});
require('eye-guide.js');
define_key(content_buffer_normal_keymap, "space", "eye-guide-scroll-down");
define_key(content_buffer_normal_keymap, "back_space", "eye-guide-scroll-up");
interactive("rgc-goto-buffer", "Switches to buffer (tab number)",
function rgc_switch_to_buffer(I){
var buff = yield I.minibuffer.read( $prompt = "Tab number?:");
switch_to_buffer(I.window, I.window.buffers.get_buffer(buff-1));
});
interactive("switch-to-recent-buffer",
"Prompt for a buffer and switch to it, displaying the list in last-visited order.",
function (I) {
switch_to_buffer(
I.window,
(yield I.minibuffer.read_buffer(
$prompt = "Switch to buffer:",
$buffers = I.window.buffers.buffer_history,
$default = (I.window.buffers.count > 1 ?
I.window.buffers.buffer_history[1] :
I.buffer))));
});
define_key(content_buffer_normal_keymap, "M-g M-g", "rgc-goto-buffer");
define_key(content_buffer_normal_keymap, "C-x C-b", "switch-to-recent-buffer");
add_hook("window_before_close_hook",
function () {
var w = get_recent_conkeror_window();
var result = (w == null) ||
"y" == (yield w.minibuffer.read_single_character_option(
$prompt = "Quit Conkeror? (y/n)",
$options = ["y", "n"]));
yield co_return(result);
});
var kill_buffer_original = kill_buffer_original || kill_buffer;
var killed_buffer_urls = [];
kill_buffer = function (buffer, force) {
if (buffer.display_uri_string) {
killed_buffer_urls.push(buffer.display_uri_string);
}
kill_buffer_original(buffer,force);
};
interactive("restore-killed-buffer-url", "Loads URL from a previously killed buffer",
function restore_killed_buffer_url (I) {
if (killed_buffer_urls.length !== 0) {
var url = yield I.minibuffer.read(
$prompt = "Restore killed url:",
$completer = new all_word_completer($completions = killed_buffer_urls),
$default_completion = killed_buffer_urls[killed_buffer_urls.length - 1],
$auto_complete = "url",
$auto_compete_initial = true,
$auto_complete_delay = 0,
$require_match = true);
load_url_in_new_buffer(url);
} else {
I.window.minibuffer.message("No killed buffer urls");
}
});
function history_clear () {
var history = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsIBrowserHistory);
history.removeAllPages();
}
interactive("history-clear", "Clear all history",
history_clear);
Bind this to C-c r
interactive("reload-config", "Reload conkerorrc",
function(I) {
load_rc();
I.window.minibuffer.message("config reloaded");
});
define_key(default_global_keymap, "C-c r", "reload-config");
User-agent is a string of text that browsers use to identify themselves to websites when making request.
session_pref("general.useragent.compatMode.firefox", true);
This is to try to mitigate Malformed webpages
require("user-agent-policy");
user_agent_policy.define_policy("default",
user_agent_firefox(),
"images.google.com",
build_url_regexp($domain = /(.*\.)?google/, $path = /images|search\?tbm=isch/),
"plus.google.com");
user_agent_policy.define_policy("firefoxcompatmode",
"Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0 conkeror/1.0pre1",
"de.eurosport.yahoo.com")
/*var user_agents = { "conkeror": "Mozilla/5.0 (X11; Linux x86_64; rv:8.0.1) " +
"Gecko/20100101 conkeror/1.0pre",
"chromium": "Mozilla/5.0 (X11; U; Linux x86_64; en-US) " +
"AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63" +
"Safari/534.3",
"firefox": "Mozilla/5.0 (X11; Linux x86_64; rv:8.0.1) " +
"Gecko/20100101 Firefox/8.0.1",
"android": "Mozilla/5.0 (Linux; U; Android 2.2; en-us; " +
"Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like " +
"Gecko) Version/4.0 Mobile Safari/533.1"};
var agent_completer = prefix_completer($completions = Object.keys(user_agents));
interactive("user-agent", "Pick a user agent from the list of presets",
function(I) {
var ua = (yield I.window.minibuffer.read(
$prompt = "Agent:",
$completer = agent_completer));
set_user_agent(user_agents[ua]);
});
*/
var my_killed_buffers = new Array();
// Save the URL of the current buffer before closing it.
interactive("my_save_url_then_kill_buffer",
"Push URL of current buffer onto stack before closing it",
function(I) {
if(my_killed_buffers.length == 10){
my_killed_buffers.shift();
// Only store 10 most recently killed entries
}
my_killed_buffers.push(I.buffer.document.URL);
kill_buffer(I.buffer);
});
// Redefine kill buffer key
undefine_key(default_global_keymap, "q");
define_key(default_global_keymap, "q", "my_save_url_then_kill_buffer");
interactive("my_restore_last_killed_buffer",
"Pop URL of last killed buffer from stack and open in new buffer.",
function(I){
if(my_killed_buffers.length > 0){
load_url_in_new_buffer(
my_killed_buffers[my_killed_buffers.length - 1], I.window);
my_killed_buffers.pop();
}
});
define_key(default_global_keymap, "Q", "my_restore_last_killed_buffer");
define_key(content_buffer_normal_keymap, "C-c c w", "org-capture");
define_key(content_buffer_normal_keymap, "C-c c l", "org-store-link");
define_key(content_buffer_normal_keymap, "C-c c j", "org-capture-journal");
define_key(content_buffer_normal_keymap, "C-c c k", "org-capture-kaizen");
define_key(content_buffer_normal_keymap, "C-c c e", "org-capture-emacs");
define_key(content_buffer_normal_keymap, "C-c c d", "org-capture-devenv");
define_key(content_buffer_normal_keymap, "C-c c p", "org-capture-code");
define_key(content_buffer_normal_keymap, "C-c c c", "org-capture-course");
define_key(content_buffer_normal_keymap, "C-c c m", "org-capture-monopoly");
interactive("duplicate-buffer", "Duplicate buffer",
function (I) {
browser_object_follow(I.buffer, OPEN_NEW_BUFFER, I.buffer.current_uri.spec);
});
define_key(content_buffer_normal_keymap, "M-D", "duplicate-buffer");
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();}
);
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.toUpperCase(), webjump + "-selection-search");
define_key(content_buffer_normal_keymap, key, "prompted-" + webjump + "-search");
}
create_selection_search("google", "o");
create_selection_search("wikipedia", "w");
create_selection_search("duckduckgo", "d");
create_selection_search("amazon", "a");
create_selection_search("youtube", "y");
Comand Line Verification that configuration loaded successfully.
Do we make it to the end?
dumpln("Conkerror.rc Parsed Successfully...");