conkeror: Add restore_killed_buffer_url

This commit is contained in:
Tom Willemsen 2013-02-07 08:55:01 +01:00
parent 6081884b9f
commit 86e131b856
2 changed files with 34 additions and 1 deletions

View file

@ -1,5 +1,5 @@
DESTDIR:=$(DESTDIR)/.conkerorrc DESTDIR:=$(DESTDIR)/.conkerorrc
modules=themes styles modules=themes styles
objects=gtk2rc init.js objects=gtk2rc init.js ext_restore.js
include ../dotfiles.mk include ../dotfiles.mk

View 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");
}
});