Hi all,

I finally took the time to write this small function that is pretty
handy to me, hope it may be usefull to someone else.  It's simply the
kill-other-buffers, that will keep current buffer alive and kill all
others buffers (within the current window).

-- 
bleader
diff --git a/modules/buffer.js b/modules/buffer.js
index 314a839..455c644 100644
--- a/modules/buffer.js
+++ b/modules/buffer.js
@@ -617,6 +617,24 @@ interactive("switch-to-buffer",
 define_variable("can_kill_last_buffer", true,
                      "If this is set to true, kill-buffer can kill the last remaining buffer, and close the window.");
 
+function kill_other_buffers(buffer)
+{
+    if (!buffer)
+        return;
+    var bs = buffer.window.buffers;
+    var b;
+
+    while ((b = bs.get_buffer(0)) != buffer)
+	    bs.kill_buffer(b);
+    var count = bs.count;
+    while (--count)
+	    bs.kill_buffer(bs.get_buffer(1));
+}
+interactive("kill-other-buffers",
+            "Kill all buffers except current one.\n",
+            function (I) {kill_other_buffers(I.buffer)});
+
+
 function kill_buffer(buffer, force)
 {
     if (!buffer)
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to