All interactive commands in conkeror should provide documentation and
there are a number of functions in conkeror that indirectly define
interactive commands, so they should allow documentation to be
provided.  Those in builtin-commands.js all provide documentation.
The functions define_buffer_mode and define_page_mode allow
documentation, although most uses of those functions do not provide
it.

This patch allows documentation to be provided where
define_global_mode and define_global_window_mode are used.
Documentation for two cases is provided for illustration.

Relatedly, the change to keymap.js suppresses a warning on
describe-command with modern XULRunner.
---
 modules/content-buffer.js |    3 ++-
 modules/keymap.js         |    2 +-
 modules/mode-line.js      |    4 +++-
 modules/mode.js           |    3 ++-
 modules/window.js         |    4 +++-
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/modules/content-buffer.js b/modules/content-buffer.js
index 35d7a7a..50e7dfd 100644
--- a/modules/content-buffer.js
+++ b/modules/content-buffer.js
@@ -471,7 +471,8 @@ define_global_mode("overlink_mode",
             delete b.overlink_mouseover;
             delete b.overlink_mouseout;
         });
-    })
+    },
+    $doc = "Show the URL, in the minibuffer, for the link under the mouse.")
 
 overlink_mode(true);
 
diff --git a/modules/keymap.js b/modules/keymap.js
index 6e9c2a2..2f9f653 100644
--- a/modules/keymap.js
+++ b/modules/keymap.js
@@ -353,7 +353,7 @@ function keymap_lookup_command (keymaps, command) {
     var list = [];
     for_each_key_binding(keymaps, function (bind_seq) {
             var bind = bind_seq[bind_seq.length - 1];
-            if (bind.command == command)
+            if (bind.command && bind.command == command)
                 list.push(format_binding_sequence(bind_seq));
         });
     return list;
diff --git a/modules/mode-line.js b/modules/mode-line.js
index ad0314f..26e594e 100644
--- a/modules/mode-line.js
+++ b/modules/mode-line.js
@@ -131,7 +131,9 @@ text_widget.prototype = {
 };
 
 
-define_global_window_mode("mode_line", "window_initialize_early_hook");
+define_global_window_mode("mode_line", "window_initialize_early_hook",
+    $doc = "The mode line is at the bottom of each buffer; it describes " +
+        "the state of that buffer and of conkeror.");
 
 
 /**
diff --git a/modules/mode.js b/modules/mode.js
index c52b483..26d5908 100644
--- a/modules/mode.js
+++ b/modules/mode.js
@@ -8,6 +8,7 @@
 require("interactive.js");
 
 function define_global_mode (name, enable, disable) {
+    keywords(arguments, $doc = null);
     var hyphen_name = name.replace("_","-","g");
     var state = name + "_enabled";
     this[state] = false;
@@ -30,7 +31,7 @@ function define_global_mode (name, enable, disable) {
         }
     };
     this[name] = func;
-    interactive(hyphen_name, null, function (I) {
+    interactive(hyphen_name, arguments.$doc, function (I) {
         var arg = I.P;
         func(arg && univ_arg_to_number(arg));
         I.minibuffer.message(hyphen_name + (conkeror[state] ? " enabled" : " 
disabled"));
diff --git a/modules/window.js b/modules/window.js
index 561570f..bee6aa8 100644
--- a/modules/window.js
+++ b/modules/window.js
@@ -208,6 +208,7 @@ define_window_local_hook("window_close_hook", RUN_HOOK);
  */
 
 function define_global_window_mode (name, hook_name) {
+    keywords(arguments, $doc = null);
     function install (window) {
         if (name in window)
             throw new Error(name + " already initialized for window");
@@ -227,7 +228,8 @@ function define_global_window_mode (name, hook_name) {
                        function () { // disable
                            remove_hook(hook_name, install);
                            for_each_window(uninstall);
-                       });
+                       },
+                       forward_keywords(arguments));
 }
 
ignore_function_for_get_caller_source_code_reference("define_global_window_mode");
 
-- 
1.7.9.1

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

Reply via email to