From 5e2b5b014b634083d5e19810dd824cf2a42364de Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Tue, 7 Jul 2009 22:08:51 +1000 Subject: [PATCH] Rename {Command,Map)#isUser{Command,Map} => #user. --- common/content/commands.js | 16 ++++++++-------- common/content/mappings.js | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/common/content/commands.js b/common/content/commands.js index 98a217e2..a7bd70d1 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -165,7 +165,7 @@ function Command(specs, description, action, extraInfo) //{{{ * unlike basic commands, may be overwritten. Users and plugin authors * should create only user commands. */ - this.isUserCommand = extraInfo.isUserCommand || false; + this.user = extraInfo.user || false; /** * @property {string} For commands defined via :command, contains the Ex * command line to be executed upon invocation. @@ -374,7 +374,7 @@ function Commands() //{{{ { if (exCommands.some(function (c) c.hasName(command.name))) { - if (command.isUserCommand && replace) + if (command.user && replace) commands.removeUserCommand(command.name); else { @@ -490,7 +490,7 @@ function Commands() //{{{ addUserCommand: function (names, description, action, extra, replace) { extra = extra || {}; - extra.isUserCommand = true; + extra.user = true; description = description || "User defined command"; return addCommand(new Command(names, description, action, extra), replace); @@ -544,7 +544,7 @@ function Commands() //{{{ */ getUserCommand: function (name) { - return exCommands.filter(function (cmd) cmd.isUserCommand && cmd.hasName(name))[0] || null; + return exCommands.filter(function (cmd) cmd.user && cmd.hasName(name))[0] || null; }, /** @@ -554,7 +554,7 @@ function Commands() //{{{ */ getUserCommands: function () { - return exCommands.filter(function (cmd) cmd.isUserCommand); + return exCommands.filter(function (cmd) cmd.user); }, // TODO: should it handle comments? @@ -921,7 +921,7 @@ function Commands() //{{{ */ removeUserCommand: function (name) { - exCommands = exCommands.filter(function (cmd) !(cmd.isUserCommand && cmd.hasName(name))); + exCommands = exCommands.filter(function (cmd) !(cmd.user && cmd.hasName(name))); }, // FIXME: still belong here? Also used for autocommand parameters. @@ -1076,7 +1076,7 @@ function Commands() //{{{ // TODO: using an array comprehension here generates flakey results across repeated calls // : perhaps we shouldn't allow options in a list call but just ignore them for now - let cmds = exCommands.filter(function (c) c.isUserCommand && (!cmd || c.name.match("^" + cmd))); + let cmds = exCommands.filter(function (c) c.user && (!cmd || c.name.match("^" + cmd))); if (cmds.length > 0) { @@ -1124,7 +1124,7 @@ function Commands() //{{{ literalArg: cmd.replacementText } for ([k, cmd] in Iterator(exCommands)) - if (cmd.isUserCommand && cmd.replacementText) + if (cmd.user && cmd.replacementText) ] }); diff --git a/common/content/mappings.js b/common/content/mappings.js index e73e0697..966200bb 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -91,7 +91,7 @@ function Map(modes, keys, description, action, extraInfo) //{{{ * mappings may be created by plugins, or directly by users. Users and * plugin authors should create only user mappings. */ - this.isUserMap = extraInfo.isUserMap || false; + this.user = extraInfo.user || false; } Map.prototype = { @@ -156,7 +156,7 @@ function Mappings() //{{{ function addMap(map) { - let where = map.isUserMap ? user : main; + let where = map.user ? user : main; map.modes.forEach(function (mode) { if (!(mode in where)) where[mode] = []; @@ -401,7 +401,7 @@ function Mappings() //{{{ { keys = keys.map(expandLeader); extra = extra || {}; - extra.isUserMap = true; + extra.user = true; let map = new Map(modes, keys, description || "User defined mapping", action, extra); // remove all old mappings to this key sequence