From 578a57337641d8f096f885bc57cc773fa5771ce1 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Wed, 27 May 2009 21:14:04 -0400 Subject: [PATCH] user_variables: replace string_hashmap with ordinary javascript object implementation --- modules/help.js | 4 ++-- modules/minibuffer-read.js | 6 ++++-- modules/utils.js | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/modules/help.js b/modules/help.js index be57beb..5084644 100644 --- a/modules/help.js +++ b/modules/help.js @@ -591,7 +591,7 @@ function describe_variable_buffer(window, element) { keywords(arguments); special_buffer.call(this, window, element, forward_keywords(arguments)); this.variable = arguments.$variable; - this.cmd = user_variables.get(this.variable); + this.cmd = user_variables[this.variable]; this.source_code_reference = this.cmd.source_code_reference; this.constructor_end(); } @@ -636,7 +636,7 @@ describe_variable_buffer.prototype = { p = g.element("p", d.body); g.variable_reference(this.variable, p); - var uvar = user_variables.get(this.variable); + var uvar = user_variables[this.variable]; if (uvar.source_code_reference) { g.text(" is a user variable in ", p); g.source_code_reference(uvar.source_code_reference, p); diff --git a/modules/minibuffer-read.js b/modules/minibuffer-read.js index 737eea7..bd3e7e1 100644 --- a/modules/minibuffer-read.js +++ b/modules/minibuffer-read.js @@ -514,9 +514,11 @@ minibuffer.prototype.read_user_variable = function () { arguments, $prompt = "User variable", $history = "user_variable", $completer = prefix_completer( - $completions = function (visitor) user_variables.for_each(visitor), + $completions = function (visitor) { + [visitor(i, user_variables[i]) for (i in user_variables)]; + }, $get_string = function (x) x, - $get_description = function (x) user_variables.get(x).shortdoc || "", + $get_description = function (x) user_variables[x].shortdoc || "", $get_value = function (x) x), $match_required = true); var result = yield this.read(forward_keywords(arguments)); diff --git a/modules/utils.js b/modules/utils.js index 5751e66..40cec41 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -902,27 +902,27 @@ function read_from_x_primary_selection () } } -var user_variables = new string_hashmap(); +var user_variables = {}; function define_variable(name, default_value, doc) { conkeror[name] = default_value; - user_variables.put(name, { + user_variables[name] = { default_value: default_value, doc: doc, shortdoc: get_shortdoc_string(doc), - source_code_reference: get_caller_source_code_reference() }); + source_code_reference: get_caller_source_code_reference() + }; } function define_special_variable(name, getter, setter, doc) { conkeror.__defineGetter__(name, getter); conkeror.__defineSetter__(name, setter); - user_variables.put(name, - { - default_value: undefined, - doc: doc, - shortdoc: get_shortdoc_string(doc), - source_code_reference: get_caller_source_code_reference() - }); + user_variables[name] = { + default_value: undefined, + doc: doc, + shortdoc: get_shortdoc_string(doc), + source_code_reference: get_caller_source_code_reference() + }; } /* Re-define load_paths as a user variable. */ -- 2.11.4.GIT