This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
.conkerorrc
188 lines (158 loc) · 7.05 KB
/
.conkerorrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// Load modules
// I decided I don't like this
//require("content-delay.js");
//require("page-modes/mini-gcal.js");
//require("page-modes/mini-gmail.js");
session_pref("xpinstall.whitelist.required", false);
// Passwords
session_pref("signon.rememberSignons", true);
session_pref("signon.expireMasterPassword", false);
session_pref("signon.SignonFileName", "signons.txt");
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); // init
// Sessions
require("session.js");
session_auto_save_auto_load = true;
// Open URLs from other places in a new buffer, unless -new is passed
command_line_handler("new", true, function (ctx) {
ctx.je_new = true;
});
function je_url_remote (url, ctx) {
if ( ctx.je_new ) {
load_url_in_new_window(url, ctx);
} else {
load_url_in_new_buffer(url, ctx);
}
}
url_remoting_fn = je_url_remote;
// Don't open a new window or take over the buffer when downloading
download_buffer_automatic_open_target = OPEN_NEW_BUFFER_BACKGROUND;
remove_hook("download_added_hook", open_download_buffer_automatically);
// Show history in goto-url minibuffer
url_completion_use_history = true;
// Expire history in X days (6 months)
session_pref('browser.history_expire_days', 30*6);
// Be able to edit in external places
editor_shell_command = "emacsclient -c";
view_source_use_external_editor = true;
// Customize mode-line
add_hook("mode_line_hook", mode_line_adder(buffer_count_widget), true);
add_hook("mode_line_hook", mode_line_adder(loading_count_widget), true);
remove_hook("mode_line_hook", mode_line_adder(clock_widget));
mode_line_mode(false);
mode_line_mode(true);
// Setup some web jumps
define_webjump("m", "https://mail.google.com/mail/u/",
$description = "GMail");
define_webjump("gr", "http://newsblur.com/folder/everything",
$description = "Newsblur");
define_webjump("c", "https://mail.google.com/mail/?view=cm&fs=1&tf=1&to&su&body&shva=1",
$description = "Compose email");
define_webjump("a", "http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=%s&x=0&y=0",
$description = "Amazon");
define_webjump("y", "http://www.youtube.com/results?search_query=%s&search=Search",
$description = "YouTube");
define_webjump("j", "http://jisho.org/words?jap=&eng=%s&dict=edict",
$description = "Jisho");
define_webjump("R", "file:///home/jay/Dev/scm/plt/racket/doc/search/index.html?q=%s",
$description = "Racket search");
define_webjump("r", "file:///home/jay/.racket/doc/search/index.html?q=%s",
$description = "Racket search");
define_webjump("g", "http://www.google.com/search?q=%s&ie=utf-8&oe=utf-8&aq=t",
$description = "Google search");
require("page-modes/wikipedia.js");
wikipedia_webjumps_format = "w";
define_wikipedia_webjumps("en");
define_webjump("arch", "https://www.archlinux.org/packages/?q=%s");
define_webjump("archwiki", "https://wiki.archlinux.org/index.php?title=Special%3ASearch&search=%s&fulltext=Search");
// Send mailto to gmail
set_protocol_handler("mailto", "https://mail.google.com/mail/?extsrc=mailto&url=%s");
// Blocks focus requests most of the time see http://conkeror.org/Focus for other options
require("block-content-focus-change.js");
// Set default download directory
cwd = make_file("~/Downloads");
// Add xkcd text
xkcd_add_title = true;
// Org-mode
function org_capture(type, url, title, text, window) {
var eurl = encodeURIComponent(url);
var etitle = encodeURIComponent(title);
var etext = encodeURIComponent(text);
var cmd_str = "emacsclient org-protocol:/capture:/" + type + "/" + eurl + "/" + etitle + "/" + etext;
window.minibuffer.message("Issuing " + cmd_str);
shell_command_blind(cmd_str);
};
interactive("org-capture", "Remember the current url with org-capture",
function (I) {
org_capture("u",
I.buffer.display_uri_string,
I.buffer.document.title,
I.buffer.top_frame.getSelection(),
I.window);
});
interactive("org-bookmark", "Bookmark the current url with org-capture",
function (I) {
org_capture("b",
I.buffer.display_uri_string,
I.buffer.document.title,
I.buffer.top_frame.getSelection(),
I.window);
});
interactive("org-open-bookmarks", "Open bookmark file",
function (I) {
var cmd_str = "emacsclient -c -e '(je/org-open-bookmarks)'";
I.window.minibuffer.message("Issuing " + cmd_str);
shell_command_blind(cmd_str);
});
define_key(content_buffer_normal_keymap, "!", "org-capture");
define_key(content_buffer_normal_keymap, "b", "org-bookmark");
define_key(default_base_keymap, "M-b", "org-open-bookmarks");
// Little guys
define_key(content_buffer_normal_keymap, "G", "find-url-new-buffer");
define_key(content_buffer_normal_keymap, "M-g", "find-alternate-url");
define_key(content_buffer_normal_keymap, "F", "follow-new-buffer");
define_key(content_buffer_normal_keymap, "M-f", "follow-new-buffer-background");
define_key(content_buffer_normal_keymap, "[", "back");
define_key(content_buffer_normal_keymap, "]", "forward");
define_key(default_global_keymap, "D", "kill-current-buffer");
define_key(default_global_keymap, "C-`", "switch-to-buffer");
// Flash killer
require("content-policy.js");
function block_flash (content_type, content_location) {
var Y = content_policy_accept, N = content_policy_reject;
var action = ([content_location.host] || N);
if (action == N)
dumpln("blocked flash: "+content_location.spec);
return action;
}
content_policy_bytype_table.object = block_flash;
add_hook("content_policy_hook", content_policy_bytype);
interactive("je/toggle-flash", "Toggles the content filter and reloads the page",
function (I) {
yield co_call(call_interactively(I, "content-policy-toggle"));
yield co_call(call_interactively(I, "reload"));
});
define_key(content_buffer_normal_keymap, "C-f", "je/toggle-flash");
// Bind number keys to switch buffers
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);
}
// Switch to last buffer
interactive("switch-to-other-buffer",
"Switch to the previously open buffer",
function (I) {
var blist = I.window.buffers.buffer_history;
if (blist.length > 1)
switch_to_buffer(I.window, blist[1]);
});
define_key(default_global_keymap, "M-tab", "switch-to-other-buffer");
define_key(default_global_keymap, "home", "cmd_scrollTop");
define_key(default_global_keymap, "M-<", "cmd_scrollTop");
// Set char set
user_pref("intl.charset.default", "utf8");