Hi

Attached is a patch that improves the gmail-go-label function, with
completion support.
Currently it can't just grab the label-names from the site. Although it
should be possible.
To use it you will need to set a variable (gmail_labels_list) in your
.conkerorrc
Example:
  var gmail_labels_list = ["Conkeror"];

If anyone wants to try creating the mechanism for grabbing the labels
automaticly, this could probably be useful:
http://code.google.com/p/gmail-greasemonkey/wiki/GmailGreasemonkey10API

But it only provides a method that gives you the DOM node of the labels
navigation box.

-- Martin
From 87094e198437fc1014a1d0ec68f6a776345f493f Mon Sep 17 00:00:00 2001
From: Martin Dybdal <[EMAIL PROTECTED](none)>
Date: Mon, 22 Sep 2008 22:19:29 +0200
Subject: [PATCH] Added simple suggestion support to gmail-label-go

---
 modules/page-modes/gmail.js |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/modules/page-modes/gmail.js b/modules/page-modes/gmail.js
index a987de2..4fa69e4 100644
--- a/modules/page-modes/gmail.js
+++ b/modules/page-modes/gmail.js
@@ -13,17 +13,40 @@ require("bindings/default/content-buffer/richedit.js");
 require("bindings/default/content-buffer/text.js");
 require("bindings/default/content-buffer/textarea.js");
 
+
+// This variable should hold the completions for
+var gmail_labels_list = [];
+//http://code.google.com/p/gmail-greasemonkey/wiki/GmailGreasemonkey10API
+
 define_keymap("gmail_keymap", $parent = content_buffer_normal_keymap);
 
 function gmail_label_go(buffer, label)
 {
     buffer.window.content.location.hash = "#label/" + encodeURIComponent(label);
 }
+
+function gmail_label_with_completion(I) {
+    var completer = all_word_completer(
+      $completions = function (visitor) { for (var i in gmail_labels_list)
+                                            visitor(gmail_labels_list[i]); },
+      $get_string = function (x) x);
+
+    gmail_label_go(
+      I.buffer,
+      (yield I.minibuffer.read(
+         $prompt = "Go to label:",
+         $completer = completer,
+         $auto_complete = "buffer",
+         $auto_complete_initial = true,
+         $auto_complete_delay = 0))
+    );
+}
+
 interactive("gmail-label-go",
             "Go to a GMail label.",
-            function(I) {
-              gmail_label_go(I.buffer, (yield I.minibuffer.read($prompt = "Go to label: ")));
-            });
+            gmail_label_with_completion);
+
+
 
 {
     let gmail_bind_common = function (keymap) {
-- 
1.5.4.3

_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to