conkeror: Add restore_killed_buffer_url
This commit is contained in:
parent
6081884b9f
commit
86e131b856
2 changed files with 34 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
DESTDIR:=$(DESTDIR)/.conkerorrc
|
||||
modules=themes styles
|
||||
objects=gtk2rc init.js
|
||||
objects=gtk2rc init.js ext_restore.js
|
||||
|
||||
include ../dotfiles.mk
|
||||
|
|
33
.conkerorrc/ext_restore.js
Normal file
33
.conkerorrc/ext_restore.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
/// From http://conkeror.org/Tips#Restore_Killed_Buffer_Url
|
||||
// I think by the time kill_buffer_hook runs the buffer is gone so I
|
||||
// patch kill_buffer
|
||||
|
||||
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 = all_word_completer($completions = killed_buffer_urls),
|
||||
$default_completion = killed_buffer_urls[killed_buffer_urls.length - 1],
|
||||
$auto_complete = "url",
|
||||
$auto_complete_initial = true,
|
||||
$auto_complete_delay = 0,
|
||||
$match_required);
|
||||
|
||||
load_url_in_new_buffer(url);
|
||||
} else {
|
||||
I.window.minibuffer.message("No killed buffer urls");
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue