diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js
index 313dae21..a39d0510 100644
--- a/common/content/abbreviations.js
+++ b/common/content/abbreviations.js
@@ -249,7 +249,7 @@ var Abbreviations = Module("abbreviations", {
},
/**
- * Lists all abbreviations matching *modes*, *lhs*, and optionally *hives*.
+ * Lists all abbreviations matching *modes*, *lhs* and optionally *hives*.
*
* @param {Array} modes List of modes.
* @param {string} lhs The LHS of the abbreviation.
diff --git a/common/content/autocommands.js b/common/content/autocommands.js
index 869c0cf8..ed5d5b04 100644
--- a/common/content/autocommands.js
+++ b/common/content/autocommands.js
@@ -84,12 +84,17 @@ var AutoCommands = Module("autocommands", {
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*, *regexp* and optionally
+ * *hives*.
*
* @param {string} event The event name filter.
* @param {string} regexp The URL pattern filter.
+ * @param {Hive[]} hives List of hives.
+ * @optional
*/
- list: function (event, regexp) {
+ list: function (event, regexp, hives) {
+
+ let hives = hives || this.activeHives;
function cmds(hive) {
let cmds = {};
@@ -108,7 +113,7 @@ var AutoCommands = Module("autocommands", {
----- Auto Commands ----- |
{
- template.map(this.activeHives, function (hive)
+ template.map(hives, function (hive)
| {hive.name} |
+
@@ -200,7 +205,7 @@ var AutoCommands = Module("autocommands", {
args["-group"].remove(event, regexp); // remove all
}
else
- autocommands.list(event, regexp); // list all
+ autocommands.list(event, regexp, args.explicitOpts["-group"] ? [args["-group"]] : null); // list all
}
}, {
bang: true,
diff --git a/common/locale/en-US/autocommands.xml b/common/locale/en-US/autocommands.xml
index 260eb074..cf4830d5 100644
--- a/common/locale/en-US/autocommands.xml
+++ b/common/locale/en-US/autocommands.xml
@@ -42,7 +42,8 @@
If the -group=group flag is given, add this autocmd
to the named group. Any filters for group apply in
- addition to filter.
+ addition to filter. When listing commands this limits the
+ output to the specified group.
Available events:
diff --git a/common/locale/en-US/map.xml b/common/locale/en-US/map.xml
index aa08b74b..26495b36 100644
--- a/common/locale/en-US/map.xml
+++ b/common/locale/en-US/map.xml
@@ -146,7 +146,7 @@
-count Accept a count before the requisite key press. Sets the count parameter to the result. (short name -c)
-description A description of this mapping (short name -d)
-ex Execute rhs as an Ex command rather than keys (short name -e)
- -group=group Add this command to the given group (short name -g)
+ -group=group Add this command to the given group (short name -g). When listing commands this limits the output to the specified group.
-javascript Execute rhs as JavaScript rather than keys (short names -js, -j)
-literal=n Parse the nth argument without specially processing any quote or meta characters. (short name -l)
-modes=modes Create this mapping in the given modes (short names -mode, -m)
@@ -591,7 +591,8 @@
The -group flag (short name: -g) can be used to
- assign this command to a specific group.
+ assign this command to a specific group. When listing
+ commands this limits the output to the specified group.
Argument handling
diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm
index 4e21e477..ae3d96e1 100644
--- a/common/modules/commands.jsm
+++ b/common/modules/commands.jsm
@@ -641,12 +641,15 @@ var Commands = Module("commands", {
},
/**
- * Displays a list of user-defined commands.
+ * Lists all user-defined commands matching *filter* and optionally
+ * *hives*.
*
* @param {string} filter Limits the list to those commands with a name
* matching this anchored substring.
+ * @param {Hive[]} hives List of hives.
+ * @optional
*/
- list: function list(filter) {
+ list: function list(filter, hives) {
const { commandline, completion } = this.modules;
function completerToString(completer) {
if (completer)
@@ -656,7 +659,7 @@ var Commands = Module("commands", {
// TODO: allow matching of aliases?
function cmds(hive) hive._list.filter(function (cmd) cmd.name.indexOf(filter || "") == 0)
- let hives = this.userHives.map(function (h) [h, cmds(h)]).filter(function ([h, c]) c.length);
+ let hives = (hives || this.userHives).map(function (h) [h, cmds(h)]).filter(function ([h, c]) c.length);
let list =
@@ -1401,7 +1404,7 @@ var Commands = Module("commands", {
_("command.invalidName", cmd));
if (args.length <= 1)
- commands.list(cmd);
+ commands.list(cmd, args.explicitOpts["-group"] ? [args["-group"]] : null);
else {
util.assert(args["-group"].modifiable,
_("group.cantChangeBuiltin", _("command.commands")));