diff options
author | Doug Kearns <dougkearns@gmail.com> | 2013-09-17 01:30:57 +1000 |
---|---|---|
committer | Doug Kearns <dougkearns@gmail.com> | 2013-09-17 01:30:57 +1000 |
commit | 041ad9ace75a01083d22931bafd2ba95171b11f8 (patch) | |
tree | ebe8f30f39e7dc3456968b2a1406eade7aacbaf7 | |
parent | 6ee830dfad7a845754e2aa499bcbd3977de49df3 (diff) | |
download | pentadactyl-041ad9ace75a01083d22931bafd2ba95171b11f8.tar.gz |
Serialize the -group flag to :abbreviate with :mkp.
-rw-r--r-- | common/content/abbreviations.js | 32 | ||||
-rw-r--r-- | common/locale/en-US/repeat.xml | 13 |
2 files changed, 27 insertions, 18 deletions
diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 2d97f7f0..0ddb625a 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -227,6 +227,10 @@ var Abbreviations = Module("abbreviations", { */), "x", params); }, + get allHives() contexts.allGroups.abbrevs, + + get userHives() this.allHives.filter(h => h !== this.builtin), + get: deprecated("group.abbrevs.get", { get: function get() this.user.closure.get }), set: deprecated("group.abbrevs.set", { get: function set() this.user.closure.set }), remove: deprecated("group.abbrevs.remove", { get: function remove() this.user.closure.remove }), @@ -257,7 +261,7 @@ var Abbreviations = Module("abbreviations", { * @optional */ list: function (modes, lhs, hives) { - let hives = hives || contexts.allGroups.abbrevs.filter(h => !h.empty); + let hives = (hives || this.userHives).filter(h => !h.empty); function abbrevs(hive) hive.merged.filter(ab => (ab.inModes(modes) && ab.lhs.indexOf(lhs) == 0)); @@ -341,18 +345,22 @@ var Abbreviations = Module("abbreviations", { description: "Expand this abbreviation by evaluating its right-hand-side as JavaScript" } ], - serialize: function () [ - { - command: this.name, - arguments: [abbr.lhs], - literalArg: abbr.rhs, - options: { - "-javascript": callable(abbr.rhs) ? null : undefined + serialize: function () array(abbreviations.userHives) + .filter(h => h.persist) + .map(hive => [ + { + command: this.name, + arguments: [abbr.lhs], + literalArg: abbr.rhs, + options: { + "-group": hive.name == "user" ? undefined : hive.name, + "-javascript": callable(abbr.rhs) ? null : undefined + } } - } - for ([, abbr] in Iterator(abbreviations.user.merged)) - if (abbr.modesEqual(modes)) - ] + for ([, abbr] in Iterator(hive.merged)) + if (abbr.modesEqual(modes)) + ]). + flatten().array }); commands.add([ch + "una[bbreviate]"], diff --git a/common/locale/en-US/repeat.xml b/common/locale/en-US/repeat.xml index f977e0cb..3aaaa4d9 100644 --- a/common/locale/en-US/repeat.xml +++ b/common/locale/en-US/repeat.xml @@ -284,12 +284,13 @@ <p> In addition to its own JavaScript context, each script is executed with its own default <link topic="groups">group</link> into which - its styles, mappings, commands, and autocommands are placed. This - means that commands such as <ex>:delcommand!</ex> can be issued - without fear of trampling other user-defined mappings. The command - <ex>:group! default</ex> can be issued to clear all such items at - once, and should be placed at the head of most scripts to prevent - the accumulation of stale items when the script is re-sourced. + its styles, mappings, commands, abbreviations and autocommands are + placed. This means that commands such as <ex>:delcommand!</ex> can + be issued without fear of trampling other user-defined mappings. + The command <ex>:group! default</ex> can be issued to clear all + such items at once, and should be placed at the head of most + scripts to prevent the accumulation of stale items when the script + is re-sourced. </p> <h3 tag=":source-css">Cascading Stylesheets</h3> |