Hi,
If conflict between actual behavior and documentation, to correct either. You
modify the document. But I modified the source code.
If we want to modify the source code, backward compatibility is considered may
not have to worry about. in this case.
Update a patch.
Adding E917 and E918 like as E474 and E475.
This error code displays the argument number of the error.
If this patch is included, I will also modify other E474 and E475. If possible.
--
Best regards,
Hirohito Higashi (a.k.a. h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt
index 84afe2f..e45f2e3 100644
--- a/runtime/doc/message.txt
+++ b/runtime/doc/message.txt
@@ -701,6 +701,12 @@ no argument has been specified.
Invalid argument
Invalid argument: {arg}
+Like above, but displays the argument number of the error.
+
+ *E917* *E918* >
+ Invalid argument#{number}
+ Invalid argument#{number}: {arg}
+
An Ex command has been executed, but an invalid argument has been specified.
*E488* >
diff --git a/src/eval.c b/src/eval.c
index 0db6cfa..7a0e69d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -18274,13 +18274,15 @@ set_qf_ll_list(
{
list_T *l = list_arg->vval.v_list;
- if (action_arg->v_type == VAR_STRING)
+ if (action_arg->v_type != VAR_UNKNOWN)
{
act = get_tv_string_chk(action_arg);
if (act == NULL)
return; /* type error; errmsg already given */
- if (*act == 'a' || *act == 'r')
+ if (*act == 'a' || *act == 'r' || *act == ' ')
action = *act;
+ else
+ EMSGN2(_(e_invargn2), wp == NULL ? 2 : 3, act);
}
if (l != NULL && set_errorlist(wp, l, action,
diff --git a/src/globals.h b/src/globals.h
index 6fd86fb..8851015 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1422,6 +1422,8 @@ EXTERN char_u e_interr[] INIT(= N_("Interrupted"));
EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address"));
EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument"));
EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
+EXTERN char_u e_invargn[] INIT(= N_("E917: Invalid argument#%d"));
+EXTERN char_u e_invargn2[] INIT(= N_("E918: Invalid argument#%d: %s"));
#ifdef FEAT_EVAL
EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
#endif
diff --git a/src/message.c b/src/message.c
index 6c9dd64..e975278 100644
--- a/src/message.c
+++ b/src/message.c
@@ -633,7 +633,8 @@ emsg2(char_u *s, char_u *a1)
return emsg3(s, a1, NULL);
}
-/* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */
+/* emsg3(), emsgn() and emsgn2() are in misc2.c to avoid warnings for the
+ * prototypes. */
void
emsg_invreg(int name)
diff --git a/src/misc2.c b/src/misc2.c
index c1519ef..6c83b0a 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -6023,6 +6023,20 @@ emsgn(char_u *s, long n)
return emsg(IObuff);
}
+/*
+ * Print an error message with one "%ld" and one long int argument with one
+ * "%s" and one string argument.
+ * This is not in message.c to avoid a warning for prototypes.
+ */
+ int
+emsgn2(char_u *s, long n, char_u *a1)
+{
+ if (emsg_not_now())
+ return TRUE; /* no error messages at the moment */
+ vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n, a1);
+ return emsg(IObuff);
+}
+
#if defined(FEAT_SPELL) || defined(FEAT_PERSISTENT_UNDO) || defined(PROTO)
/*
* Read 2 bytes from "fd" and turn them into an int, MSB first.
diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro
index 676eb95..ba02ad9 100644
--- a/src/proto/misc2.pro
+++ b/src/proto/misc2.pro
@@ -100,6 +100,7 @@ int pathcmp(const char *p, const char *q, int maxlen);
int filewritable(char_u *fname);
int emsg3(char_u *s, char_u *a1, char_u *a2);
int emsgn(char_u *s, long n);
+int emsgn2(char_u *s, long n, char_u *a1);
int get2c(FILE *fd);
int get3c(FILE *fd);
int get4c(FILE *fd);
diff --git a/src/vim.h b/src/vim.h
index fc693b3..470bc97 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1550,6 +1550,7 @@ typedef UINT32_TYPEDEF UINT32_T;
#define EMSG2(s, p) emsg2((char_u *)(s), (char_u *)(p))
#define EMSG3(s, p, q) emsg3((char_u *)(s), (char_u *)(p), (char_u *)(q))
#define EMSGN(s, n) emsgn((char_u *)(s), (long)(n))
+#define EMSGN2(s, n, p) emsgn2((char_u *)(s), (long)(n), (char_u *)(p))
#define EMSGU(s, n) emsgu((char_u *)(s), (long_u)(n))
#define OUT_STR(s) out_str((char_u *)(s))
#define OUT_STR_NF(s) out_str_nf((char_u *)(s))