mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-31 13:53:32 +02:00
Make userContext a proper Context.
This commit is contained in:
@@ -12,9 +12,6 @@ default xml namespace = XHTML;
|
|||||||
XML.ignoreWhitespace = false;
|
XML.ignoreWhitespace = false;
|
||||||
XML.prettyPrinting = false;
|
XML.prettyPrinting = false;
|
||||||
|
|
||||||
var userContext = { __proto__: modules };
|
|
||||||
var _userContext = newContext(userContext);
|
|
||||||
|
|
||||||
var EVAL_ERROR = "__dactyl_eval_error";
|
var EVAL_ERROR = "__dactyl_eval_error";
|
||||||
var EVAL_RESULT = "__dactyl_eval_result";
|
var EVAL_RESULT = "__dactyl_eval_result";
|
||||||
var EVAL_STRING = "__dactyl_eval_string";
|
var EVAL_STRING = "__dactyl_eval_string";
|
||||||
|
|||||||
@@ -375,19 +375,14 @@ var Tabs = Module("tabs", {
|
|||||||
* reloading.
|
* reloading.
|
||||||
*/
|
*/
|
||||||
reloadAll: function (bypassCache) {
|
reloadAll: function (bypassCache) {
|
||||||
if (bypassCache) {
|
this.visibleTabs.forEach(function (tab) {
|
||||||
for (let i = 0; i < config.tabbrowser.mTabs.length; i++) {
|
try {
|
||||||
try {
|
this.reload(config.tabbrowser.mTabs[i], bypassCache);
|
||||||
this.reload(config.tabbrowser.mTabs[i], bypassCache);
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
// FIXME: can we do anything useful here without stopping the
|
|
||||||
// other tabs from reloading?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
catch (e) {
|
||||||
else
|
dactyl.reportError(e, true);
|
||||||
config.tabbrowser.reloadAllTabs();
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
<dt>-group=<a>group</a></dt> <dd>Add this command to the given <t>group</t> (short name <em>-g</em>)</dd>
|
<dt>-group=<a>group</a></dt> <dd>Add this command to the given <t>group</t> (short name <em>-g</em>)</dd>
|
||||||
<dt>-javascript</dt> <dd>Execute <a>rhs</a> as JavaScript rather than keys (short names <em>-js</em>, <em>-j</em>)</dd>
|
<dt>-javascript</dt> <dd>Execute <a>rhs</a> as JavaScript rather than keys (short names <em>-js</em>, <em>-j</em>)</dd>
|
||||||
<dt>-literal=<a>n</a></dt> <dd>Parse the <a>n</a>th argument without specially processing any quote or meta characters. (short name <em>-l</em>)</dd>
|
<dt>-literal=<a>n</a></dt> <dd>Parse the <a>n</a>th argument without specially processing any quote or meta characters. (short name <em>-l</em>)</dd>
|
||||||
<dt>-modes</dt> <dd>Create this mapping in the given modes (short names <em>-mode</em>, <em>-m</em>)</dd>
|
<dt>-modes=<a>modes</a></dt> <dd>Create this mapping in the given modes (short names <em>-mode</em>, <em>-m</em>)</dd>
|
||||||
<dt>-nopersist</dt> <dd>Do not save this mapping to an auto-generated rc file (short name <em>-n</em>)</dd>
|
<dt>-nopersist</dt> <dd>Do not save this mapping to an auto-generated rc file (short name <em>-n</em>)</dd>
|
||||||
<dt>-silent</dt> <dd>Do not echo any generated keys to the command line (short name <em>-s</em>, also <em><silent></em> for Vim compatibility)</dd>
|
<dt>-silent</dt> <dd>Do not echo any generated keys to the command line (short name <em>-s</em>, also <em><silent></em> for Vim compatibility)</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@@ -620,6 +620,7 @@ function memoize(obj, key, getter) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
util.reportError(e);
|
||||||
obj[key] = getter.call(obj, key);
|
obj[key] = getter.call(obj, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,9 @@ var Contexts = Module("contexts", {
|
|||||||
|
|
||||||
completer: function (context) modules.completion.group(context)
|
completer: function (context) modules.completion.group(context)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
memoize(modules, "userContext", function () contexts.Context(modules.io.getRCFile("~"), contexts.user, [modules, true]));
|
||||||
|
memoize(modules, "_userContext", function () contexts.Context(modules.io.getRCFile("~"), contexts.user, [modules.userContext]));
|
||||||
},
|
},
|
||||||
|
|
||||||
cleanup: function () {
|
cleanup: function () {
|
||||||
@@ -187,7 +190,7 @@ var Contexts = Module("contexts", {
|
|||||||
let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-")
|
let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-")
|
||||||
: file.leafName;
|
: file.leafName;
|
||||||
|
|
||||||
self = update(newContext.apply(null, args || [userContext]), {
|
self = update(args && !isArray(args) ? args : newContext.apply(null, args || [userContext]), {
|
||||||
NAME: Const(name.replace(/\.[^.]*$/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase())),
|
NAME: Const(name.replace(/\.[^.]*$/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase())),
|
||||||
|
|
||||||
PATH: Const(file.path),
|
PATH: Const(file.path),
|
||||||
@@ -212,7 +215,7 @@ var Contexts = Module("contexts", {
|
|||||||
contexts.removeGroup(this.GROUP);
|
contexts.removeGroup(this.GROUP);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
Class.replaceProperty(plugins, file.path, self);
|
// Class.replaceProperty(plugins, file.path, self);
|
||||||
|
|
||||||
// This belongs elsewhere
|
// This belongs elsewhere
|
||||||
if (isPlugin && args)
|
if (isPlugin && args)
|
||||||
|
|||||||
Reference in New Issue
Block a user