[Conkeror] [PATCH] Provide the buffer number and number of buffers in the modeline.
David Kettler
David.Kettler at dsto.defence.gov.au
Wed Sep 24 20:55:51 PDT 2008
This provides a count like [2/5] in the mode-line. It's probably not
useful when using the tab bar; that provides more visual feedback.
Enable using the following in your rc:
add_hook("mode_line_hook", mode_line_adder(buffer_count_widget), true);
---
I don't use anything like this in emacs. I think in a web browser I
tend to have a lot more temporary buffers and this helps me keep track
of what I still need to look at.
modules/mode-line.js | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/modules/mode-line.js b/modules/mode-line.js
index 1917159..e2614e1 100644
--- a/modules/mode-line.js
+++ b/modules/mode-line.js
@@ -193,6 +193,19 @@ clock_widget.prototype.destroy = function () {
this.window.clearTimeout(this.timer_ID);
};
+function buffer_count_widget(window) {
+ this.name = "buffer-count-widget";
+ text_widget.call(this, window);
+ this.add_hook("select_buffer_hook");
+ this.add_hook("create_buffer_hook");
+ this.add_hook("kill_buffer_hook");
+}
+buffer_count_widget.prototype.__proto__ = text_widget.prototype;
+buffer_count_widget.prototype.update = function () {
+ this.view.text = ("[" + (this.window.buffers.selected_index+1) + "/" +
+ this.window.buffers.count + "]");
+};
+
function mode_line_adder(widget_constructor) {
return function (window) { window.mode_line.add_text_widget(new widget_constructor(window)); }
}
--
1.6.0.2.304.gc76d.dirty
--
IMPORTANT: This email remains the property of the Australian Defence
Organisation and is subject to the jurisdiction of section 70 of the
CRIMES ACT 1914. If you have received this email in error, you are
requested to contact the sender and delete the email.
More information about the Conkeror
mailing list