summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2013-02-07 08:55:01 +0100
committerGravatar Tom Willemsen2013-02-07 08:55:01 +0100
commit86e131b856366a0770053d2cdb258435eb233afa (patch)
tree49b081a5a2bdd6b4f5a2e617f198d5f5b3314039
parent6081884b9f565b6c5e251ecfa27f4362a9790d99 (diff)
downloaddotfiles-86e131b856366a0770053d2cdb258435eb233afa.tar.gz
dotfiles-86e131b856366a0770053d2cdb258435eb233afa.zip
conkeror: Add restore_killed_buffer_url
-rw-r--r--.conkerorrc/Makefile2
-rw-r--r--.conkerorrc/ext_restore.js33
2 files changed, 34 insertions, 1 deletions
diff --git a/.conkerorrc/Makefile b/.conkerorrc/Makefile
index 12ed611..8161f39 100644
--- a/.conkerorrc/Makefile
+++ b/.conkerorrc/Makefile
@@ -1,5 +1,5 @@
DESTDIR:=$(DESTDIR)/.conkerorrc
modules=themes styles
-objects=gtk2rc init.js
+objects=gtk2rc init.js ext_restore.js
include ../dotfiles.mk
diff --git a/.conkerorrc/ext_restore.js b/.conkerorrc/ext_restore.js
new file mode 100644
index 0000000..39b125e
--- /dev/null
+++ b/.conkerorrc/ext_restore.js
@@ -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");
+ }
+ });