patch 8.2.3141: no error when using :complete for :command without -nargs
Problem: No error when using :complete for :command without -nargs.
Solution: Give an error. (Martin Tournoij, closes #8544, closes #8541)
diff --git a/src/usercmd.c b/src/usercmd.c
index a4bbfd7..94ebb43 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1019,21 +1019,15 @@
// we are listing commands
p = skipwhite(end);
if (!has_attr && ends_excmd2(eap->arg, p))
- {
uc_list(name, end - name);
- }
else if (!ASCII_ISUPPER(*name))
- {
emsg(_("E183: User defined commands must start with an uppercase letter"));
- return;
- }
else if ((name_len == 1 && *name == 'X')
|| (name_len <= 4
&& STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0))
- {
emsg(_("E841: Reserved name, cannot be used for user defined command"));
- return;
- }
+ else if (compl > 0 && (argt & EX_EXTRA) == 0)
+ emsg(_(e_complete_used_without_nargs));
else
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
addr_type_arg, eap->forceit);