mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-30 18:55:46 +01:00
Camel-case some identifiers gone rogue.
Do not free a camel of the burden of his hump; you may be freeing him from being a camel. - G. K. Chesterton
This commit is contained in:
@@ -236,7 +236,7 @@ const Abbreviations = Module("abbreviations", {
|
||||
if (rhs) {
|
||||
if (args["-javascript"]) {
|
||||
let expr = rhs;
|
||||
rhs = dactyl.userfunc("editor", expr);
|
||||
rhs = dactyl.userFunc("editor", expr);
|
||||
rhs.toString = function () expr;
|
||||
}
|
||||
abbreviations.add(modes, lhs, rhs);
|
||||
|
||||
@@ -174,7 +174,7 @@ const AutoCommands = Module("autocommands", {
|
||||
if (args.bang)
|
||||
autocommands.remove(event, regex);
|
||||
if (args["-javascript"])
|
||||
cmd = dactyl.userfunc("args", "with(args) {" + cmd + "}");
|
||||
cmd = dactyl.userFunc("args", "with(args) {" + cmd + "}");
|
||||
autocommands.add(events, regex, cmd);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -500,7 +500,7 @@ const Buffer = Module("buffer", {
|
||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||
win.dactylFocusAllowed = true;
|
||||
|
||||
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
||||
if (isInstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
|
||||
elem.contentWindow.focus();
|
||||
else if (elem instanceof HTMLInputElement && elem.type == "file") {
|
||||
Buffer.openUploadPrompt(elem);
|
||||
@@ -592,7 +592,7 @@ const Buffer = Module("buffer", {
|
||||
let offsetX = 1;
|
||||
let offsetY = 1;
|
||||
|
||||
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) {
|
||||
if (isInstance(elem, [HTMLFrameElement, HTMLIFrameElement])) {
|
||||
buffer.focusElement(elem);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ const CommandLine = Module("commandline", {
|
||||
highlightGroup = highlightGroup || this.HL_NORMAL;
|
||||
|
||||
if (flags & this.APPEND_TO_MESSAGES) {
|
||||
let message = isobject(str) ? str : { message: str };
|
||||
let message = isObject(str) ? str : { message: str };
|
||||
this._messageHistory.add(update({ highlight: highlightGroup }, message));
|
||||
str = message.message;
|
||||
}
|
||||
@@ -1388,7 +1388,7 @@ const CommandLine = Module("commandline", {
|
||||
return "";
|
||||
|
||||
try {
|
||||
arg = dactyl.usereval(arg);
|
||||
arg = dactyl.userEval(arg);
|
||||
}
|
||||
catch (e) {
|
||||
dactyl.echoerr(e);
|
||||
|
||||
@@ -934,7 +934,7 @@ const Commands = Module("commands", {
|
||||
try {
|
||||
let compObject = command.completer.call(command, cmdContext, args);
|
||||
|
||||
if (isarray(compObject)) // for now at least, let completion functions return arrays instead of objects
|
||||
if (isArray(compObject)) // for now at least, let completion functions return arrays instead of objects
|
||||
compObject = { start: compObject[0], items: compObject[1] };
|
||||
if (compObject != null) {
|
||||
cmdContext.advance(compObject.start);
|
||||
@@ -1004,7 +1004,7 @@ const Commands = Module("commands", {
|
||||
completeOpt = completeOpt.substr(7);
|
||||
completeFunc = function () {
|
||||
try {
|
||||
var completer = dactyl.usereval(completeOpt);
|
||||
var completer = dactyl.userEval(completeOpt);
|
||||
|
||||
if (!callable(completer))
|
||||
throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function");
|
||||
|
||||
@@ -262,7 +262,7 @@ const CompletionContext = Class("CompletionContext", {
|
||||
get completions() this._completions || [],
|
||||
set completions(items) {
|
||||
// Accept a generator
|
||||
if (!isarray(items))
|
||||
if (!isArray(items))
|
||||
items = [x for (x in Iterator(items))];
|
||||
if (this._completions !== items) {
|
||||
delete this.cache.filtered;
|
||||
|
||||
@@ -252,11 +252,11 @@ const Dactyl = Module("dactyl", {
|
||||
echoerr: function echoerr(str, flags) {
|
||||
flags |= commandline.APPEND_TO_MESSAGES;
|
||||
|
||||
if (isinstance(str, ["Error", "Exception"]))
|
||||
if (isInstance(str, ["Error", "Exception"]))
|
||||
dactyl.reportError(str);
|
||||
if (typeof str == "object" && "echoerr" in str)
|
||||
str = str.echoerr;
|
||||
else if (isinstance(str, ["Error"]))
|
||||
else if (isInstance(str, ["Error"]))
|
||||
str = str.fileName + ":" + str.lineNumber + ": " + str;
|
||||
|
||||
if (options["errorbells"])
|
||||
@@ -299,7 +299,7 @@ const Dactyl = Module("dactyl", {
|
||||
services.get("subscriptLoader").loadSubScript(uri, context);
|
||||
},
|
||||
|
||||
usereval: function (str, context) {
|
||||
userEval: function (str, context) {
|
||||
try {
|
||||
if (!context)
|
||||
context = userContext;
|
||||
@@ -328,8 +328,8 @@ const Dactyl = Module("dactyl", {
|
||||
* Acts like the Function builtin, but the code executes in the
|
||||
* userContext global.
|
||||
*/
|
||||
userfunc: function () {
|
||||
return this.usereval(
|
||||
userFunc: function () {
|
||||
return this.userEval(
|
||||
"(function (" +
|
||||
Array.slice(arguments, 0, -1).join(", ") +
|
||||
") { " + arguments[arguments.length - 1] + " })");
|
||||
@@ -338,7 +338,7 @@ const Dactyl = Module("dactyl", {
|
||||
// partial sixth level expression evaluation
|
||||
// TODO: what is that really needed for, and where could it be used?
|
||||
// Or should it be removed? (c) Viktor
|
||||
// Better name? See other dactyl.usereval()
|
||||
// Better name? See other dactyl.userEval()
|
||||
// I agree, the name is confusing, and so is the
|
||||
// description --Kris
|
||||
evalExpression: function (str) {
|
||||
@@ -839,7 +839,7 @@ const Dactyl = Module("dactyl", {
|
||||
});
|
||||
|
||||
params = params || {};
|
||||
if (isarray(params))
|
||||
if (isArray(params))
|
||||
params = { where: params };
|
||||
|
||||
let flags = 0;
|
||||
@@ -1413,7 +1413,7 @@ const Dactyl = Module("dactyl", {
|
||||
"Execute the argument as an Ex command",
|
||||
function (args) {
|
||||
try {
|
||||
let cmd = dactyl.usereval(args.string);
|
||||
let cmd = dactyl.userEval(args.string);
|
||||
dactyl.execute(cmd, null, true);
|
||||
}
|
||||
catch (e) {
|
||||
@@ -1428,7 +1428,7 @@ const Dactyl = Module("dactyl", {
|
||||
getAddonByID: function (id, callback) {
|
||||
callback = callback || util.identity;
|
||||
let addon = id;
|
||||
if (!isobject(addon))
|
||||
if (!isObject(addon))
|
||||
addon = services.get("extensionManager").getItemForID(id);
|
||||
if (!addon)
|
||||
return callback(null);
|
||||
@@ -1714,7 +1714,7 @@ const Dactyl = Module("dactyl", {
|
||||
}
|
||||
else {
|
||||
try {
|
||||
dactyl.usereval(args.string);
|
||||
dactyl.userEval(args.string);
|
||||
}
|
||||
catch (e) {
|
||||
dactyl.echoerr(e);
|
||||
@@ -1807,7 +1807,7 @@ const Dactyl = Module("dactyl", {
|
||||
if (args[0] == ":")
|
||||
var method = function () dactyl.execute(args, null, true);
|
||||
else
|
||||
method = dactyl.userfunc(args);
|
||||
method = dactyl.userFunc(args);
|
||||
|
||||
try {
|
||||
if (count > 1) {
|
||||
|
||||
@@ -24,7 +24,7 @@ const Events = Module("events", {
|
||||
|
||||
this._macros = storage.newMap("macros", { privateData: true, store: true });
|
||||
for (let [k, m] in this._macros)
|
||||
if (isstring(m))
|
||||
if (isString(m))
|
||||
m = { keys: m, timeRecorded: Date.now() };
|
||||
|
||||
// NOTE: the order of ["Esc", "Escape"] or ["Escape", "Esc"]
|
||||
@@ -741,7 +741,7 @@ const Events = Module("events", {
|
||||
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
|
||||
|
||||
if (Events.isContentNode(elem) && !buffer.focusAllowed(win)
|
||||
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
|
||||
&& isInstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
|
||||
elem.blur();
|
||||
},
|
||||
|
||||
@@ -773,7 +773,7 @@ const Events = Module("events", {
|
||||
return;
|
||||
}
|
||||
|
||||
if(isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
|
||||
if(isInstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
|
||||
dactyl.mode = modes.EMBED;
|
||||
return;
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ const Events = Module("events", {
|
||||
isInputElemFocused: function () {
|
||||
let elem = dactyl.focus;
|
||||
return elem instanceof HTMLInputElement && set.has(Events.editableInputs, elem.type) ||
|
||||
isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement,
|
||||
isInstance(elem, [HTMLIsIndexElement, HTMLEmbedElement,
|
||||
HTMLObjectElement, HTMLTextAreaElement]);
|
||||
}
|
||||
}, {
|
||||
|
||||
@@ -260,7 +260,7 @@ const Hints = Module("hints", {
|
||||
if (computedStyle.visibility != "visible" || computedStyle.display == "none")
|
||||
continue;
|
||||
|
||||
if (isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
|
||||
if (isInstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
|
||||
[hint.text, hint.showText] = this._getInputHint(elem, doc);
|
||||
else
|
||||
hint.text = elem.textContent.toLowerCase();
|
||||
|
||||
@@ -311,7 +311,7 @@ lookup:
|
||||
*/
|
||||
source: function (filename, silent) {
|
||||
let wasSourcing = this.sourcing;
|
||||
defmodule.loadLog.push("sourcing " + filename);
|
||||
defineModule.loadLog.push("sourcing " + filename);
|
||||
let time = Date.now();
|
||||
try {
|
||||
var file = io.File(filename);
|
||||
@@ -343,7 +343,7 @@ lookup:
|
||||
dactyl.helpInitialized = false;
|
||||
}
|
||||
catch (e) {
|
||||
if (isstring(e))
|
||||
if (isString(e))
|
||||
e = { message: e };
|
||||
let err = new Error();
|
||||
for (let [k, v] in Iterator(e))
|
||||
@@ -431,7 +431,7 @@ lookup:
|
||||
dactyl.echoerr(message);
|
||||
}
|
||||
finally {
|
||||
defmodule.loadLog.push("done sourcing " + filename + ": " + (Date.now() - time) + "ms");
|
||||
defineModule.loadLog.push("done sourcing " + filename + ": " + (Date.now() - time) + "ms");
|
||||
this.sourcing = wasSourcing;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -75,7 +75,7 @@ const JavaScript = Module("javascript", {
|
||||
|
||||
context[JavaScript.EVAL_TMP] = tmp;
|
||||
try {
|
||||
return cache[key] = dactyl.usereval(arg, context);
|
||||
return cache[key] = dactyl.userEval(arg, context);
|
||||
}
|
||||
catch (e) {
|
||||
this.context.message = "Error: " + e;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
const Map = Class("Map", {
|
||||
init: function (modes, keys, description, action, extraInfo) {
|
||||
modes = Array.concat(modes).map(function (m) isobject(m) ? m.mask : m);
|
||||
modes = Array.concat(modes).map(function (m) isObject(m) ? m.mask : m);
|
||||
|
||||
this.id = ++Map.id;
|
||||
this.modes = modes;
|
||||
@@ -392,7 +392,7 @@ const Mappings = Module("mappings", {
|
||||
else {
|
||||
if (args["-javascript"]) {
|
||||
rhs = ["-javascript", rhs];
|
||||
var action = dactyl.userfunc("count", rhs);
|
||||
var action = dactyl.userFunc("count", rhs);
|
||||
}
|
||||
else if (args["-ex"]) {
|
||||
rhs = ["-ex", rhs];
|
||||
|
||||
@@ -17,7 +17,7 @@ const Marks = Module("marks", {
|
||||
this._urlMarks = storage.newMap("url-marks", { privateData: true, replacer: replacer, store: true });
|
||||
|
||||
try {
|
||||
if(isarray(Iterator(this._localMarks).next()[1]))
|
||||
if(isArray(Iterator(this._localMarks).next()[1]))
|
||||
this._localMarks.clear();
|
||||
}
|
||||
catch(e) {}
|
||||
|
||||
@@ -15,7 +15,7 @@ const ModuleBase = Class("ModuleBase", {
|
||||
*/
|
||||
requires: [],
|
||||
|
||||
toString: function () "[module " + this.constructor.classname + "]"
|
||||
toString: function () "[module " + this.constructor.className + "]"
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -76,9 +76,9 @@ window.addEventListener("load", function onLoad() {
|
||||
window.removeEventListener("load", onLoad, false);
|
||||
|
||||
Module.list.forEach(function (module) {
|
||||
modules.__defineGetter__(module.classname, function () {
|
||||
delete modules[module.classname];
|
||||
return load(module.classname, null, Components.stack.caller);
|
||||
modules.__defineGetter__(module.className, function () {
|
||||
delete modules[module.className];
|
||||
return load(module.className, null, Components.stack.caller);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,11 +91,11 @@ window.addEventListener("load", function onLoad() {
|
||||
|
||||
function init(module) {
|
||||
function init(func, mod)
|
||||
function () defmodule.time(module.classname || module.constructor.classname, mod,
|
||||
function () defineModule.time(module.className || module.constructor.className, mod,
|
||||
func, module,
|
||||
dactyl, modules, window);
|
||||
|
||||
set.add(loaded, module.constructor.classname);
|
||||
set.add(loaded, module.constructor.className);
|
||||
for (let [mod, func] in Iterator(module.INIT)) {
|
||||
if (mod in loaded)
|
||||
init(func, mod)();
|
||||
@@ -105,45 +105,45 @@ window.addEventListener("load", function onLoad() {
|
||||
}
|
||||
}
|
||||
}
|
||||
defmodule.modules.map(init);
|
||||
defineModule.modules.map(init);
|
||||
|
||||
function load(module, prereq, frame) {
|
||||
if (isstring(module)) {
|
||||
if (isString(module)) {
|
||||
if (!Module.constructors.hasOwnProperty(module))
|
||||
modules.load(module);
|
||||
module = Module.constructors[module];
|
||||
}
|
||||
|
||||
try {
|
||||
if (module.classname in loaded)
|
||||
if (module.className in loaded)
|
||||
return;
|
||||
if (module.classname in seen)
|
||||
if (module.className in seen)
|
||||
throw Error("Module dependency loop.");
|
||||
set.add(seen, module.classname);
|
||||
set.add(seen, module.className);
|
||||
|
||||
for (let dep in values(module.requires))
|
||||
load(Module.constructors[dep], module.classname);
|
||||
load(Module.constructors[dep], module.className);
|
||||
|
||||
defmodule.loadLog.push("Load" + (isstring(prereq) ? " " + prereq + " dependency: " : ": ") + module.classname);
|
||||
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
|
||||
if (frame && frame.filename)
|
||||
defmodule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
||||
defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
||||
|
||||
delete modules[module.classname];
|
||||
modules[module.classname] = defmodule.time(module.classname, "init", module);
|
||||
delete modules[module.className];
|
||||
modules[module.className] = defineModule.time(module.className, "init", module);
|
||||
|
||||
init(modules[module.classname]);
|
||||
for (let [, fn] in iter(deferredInit[module.classname] || []))
|
||||
init(modules[module.className]);
|
||||
for (let [, fn] in iter(deferredInit[module.className] || []))
|
||||
fn();
|
||||
}
|
||||
catch (e) {
|
||||
dump("Loading " + (module && module.classname) + ": " + e + "\n" + (e.stack || ""));
|
||||
dump("Loading " + (module && module.className) + ": " + e + "\n" + (e.stack || ""));
|
||||
}
|
||||
return modules[module.classname];
|
||||
return modules[module.className];
|
||||
}
|
||||
|
||||
Module.list.forEach(load);
|
||||
deferredInit["load"].forEach(call);
|
||||
modules.times = update({}, defmodule.times);
|
||||
modules.times = update({}, defineModule.times);
|
||||
|
||||
dump("Loaded in " + (Date.now() - start) + "ms");
|
||||
}, false);
|
||||
|
||||
@@ -1123,7 +1123,7 @@ const Options = Module("options", {
|
||||
|
||||
if (context.filter.indexOf("=") == -1) {
|
||||
if (false && prefix)
|
||||
context.filters.push(function ({ item }) item.type == "boolean" || prefix == "inv" && isarray(item.values));
|
||||
context.filters.push(function ({ item }) item.type == "boolean" || prefix == "inv" && isArray(item.values));
|
||||
return completion.option(context, opt.scope, prefix);
|
||||
}
|
||||
|
||||
@@ -1152,7 +1152,7 @@ const Options = Module("options", {
|
||||
completion.optionValue(optcontext, opt.name, opt.operator);
|
||||
|
||||
// Fill in the current values if we're removing
|
||||
if (opt.operator == "-" && isarray(opt.values)) {
|
||||
if (opt.operator == "-" && isArray(opt.values)) {
|
||||
let have = set([i.text for (i in context.allItems)]);
|
||||
context = context.fork("current-values", 0);
|
||||
context.anchored = optcontext.anchored;
|
||||
@@ -1326,7 +1326,7 @@ const Options = Module("options", {
|
||||
context.completions = options;
|
||||
if (prefix == "inv")
|
||||
context.keys.text = function (opt)
|
||||
opt.type == "boolean" || isarray(opt.values) ? opt.names.map(function (n) "inv" + n)
|
||||
opt.type == "boolean" || isArray(opt.values) ? opt.names.map(function (n) "inv" + n)
|
||||
: opt.names;
|
||||
if (scope)
|
||||
context.filters.push(function ({ item }) item.scope & scope);
|
||||
@@ -1377,7 +1377,7 @@ const Options = Module("options", {
|
||||
context.title = ["Option Value"];
|
||||
// Not Vim compatible, but is a significant enough improvement
|
||||
// that it's worth breaking compatibility.
|
||||
if (isarray(newValues)) {
|
||||
if (isArray(newValues)) {
|
||||
context.filters.push(function (i) newValues.indexOf(i.text) == -1);
|
||||
if (op == "+")
|
||||
context.filters.push(function (i) curValues.indexOf(i.text) == -1);
|
||||
|
||||
Reference in New Issue
Block a user