1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-30 00:33:33 +02:00

Fix a silly error in modes.set.

This commit is contained in:
Kris Maglione
2011-02-23 16:41:26 -05:00
parent 2c109025bf
commit 80ca9194ec
4 changed files with 25 additions and 13 deletions

View File

@@ -73,15 +73,15 @@ var AutoCommands = Module("autocommands", {
hives: contexts.Hives("autocmd", AutoCmdHive), hives: contexts.Hives("autocmd", AutoCmdHive),
user: contexts.hives.autocmd.user, user: contexts.hives.autocmd.user,
allHives: contexts.allGroups.autocmd, allHives: contexts.allGroups.autocmd,
matchingHives: function matchingHives(uri) contexts.matchingGroups(uri).autocmd matchingHives: function matchingHives(uri, doc) contexts.matchingGroups(uri, doc).autocmd
}); });
}, },
get activeHives() contexts.allGroups.autocmd.filter(function (h) h._store.length), get activeHives() contexts.allGroups.autocmd.filter(function (h) h._store.length),
add: deprecated("autocommand.user.add", { get: function add() autocommands.user.closure.add }), add: deprecated("group.autocmd.add", { get: function add() autocommands.user.closure.add }),
get: deprecated("autocommand.user.get", { get: function get() autocommands.user.closure.get }), get: deprecated("group.autocmd.get", { get: function get() autocommands.user.closure.get }),
remove: deprecated("autocommand.user.remove", { get: function remove() autocommands.user.closure.remove }), remove: deprecated("group.autocmd.remove", { get: function remove() autocommands.user.closure.remove }),
/** /**
* Lists all autocommands with a matching *event* and *regexp*. * Lists all autocommands with a matching *event* and *regexp*.
@@ -142,16 +142,18 @@ var AutoCommands = Module("autocommands", {
dactyl.echomsg('Executing ' + event + ' Auto commands for "*"', 8); dactyl.echomsg('Executing ' + event + ' Auto commands for "*"', 8);
let lastPattern = null; let lastPattern = null;
let uri = args.url ? util.createURI(args.url) : buffer.uri; let { uri, doc } = args;
if (!uri)
({ uri, doc }) = buffer;
event = event.toLowerCase(); event = event.toLowerCase();
for (let hive in values(this.matchingHives(uri))) { for (let hive in values(this.matchingHives(uri, doc))) {
let args = update({}, let args = update({},
hive.argsExtra(arguments[1]), hive.argsExtra(arguments[1]),
arguments[1]); arguments[1]);
for (let autoCmd in values(hive._store)) for (let autoCmd in values(hive._store))
if (autoCmd.eventName === event && autoCmd.filter(uri)) { if (autoCmd.eventName === event && autoCmd.filter(uri, doc)) {
if (!lastPattern || lastPattern !== String(autoCmd.filter)) if (!lastPattern || lastPattern !== String(autoCmd.filter))
dactyl.echomsg("Executing " + event + " Auto commands for " + autoCmd.filter, 8); dactyl.echomsg("Executing " + event + " Auto commands for " + autoCmd.filter, 8);

View File

@@ -227,10 +227,16 @@ var Buffer = Module("buffer", {
}, },
set lastInputField(value) { this.localStore.lastInputField = value && Cu.getWeakReference(value); }, set lastInputField(value) { this.localStore.lastInputField = value && Cu.getWeakReference(value); },
/**
* @property {nsIURI} The current top-level document.
*/
get doc() window.content.document,
/** /**
* @property {nsIURI} The current top-level document's URI. * @property {nsIURI} The current top-level document's URI.
*/ */
get uri() util.newURI(content.location.href), get uri() util.newURI(content.location.href),
/** /**
* @property {nsIURI} The current top-level document's URI, sans any * @property {nsIURI} The current top-level document's URI, sans any
* fragment identifier. * fragment identifier.

View File

@@ -310,14 +310,14 @@ var Modes = Module("modes", {
return; return;
} }
params = params || this.getMode(mainMode || this.main).params;
if (!stack && mainMode != null && this._modeStack.length > 1)
this.reset();
this.withSavedValues(["inSet"], function set() { this.withSavedValues(["inSet"], function set() {
this.inSet = true; this.inSet = true;
params = params || this.getMode(mainMode || this.main).params;
if (!stack && mainMode != null && this._modeStack.length > 1)
this.reset();
oldMain = this._main, oldExtended = this._extended; oldMain = this._main, oldExtended = this._extended;
if (extendedMode != null) if (extendedMode != null)

View File

@@ -267,7 +267,11 @@ var Contexts = Module("contexts", {
groups: { value: this.activeGroups(uri) }, groups: { value: this.activeGroups(uri) },
}), }),
activeGroups: function (uri) this.initializedGroups().filter(function (g) g.filter(this), uri || this.modules.buffer.uri), activeGroups: function (uri, doc) {
if (!uri)
({ uri, doc }) = this.modules.buffer;
return this.initializedGroups().filter(function (g) g.filter(uri, doc));
},
flush: function flush() { flush: function flush() {
delete this.groups; delete this.groups;