-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make emsg()
take variable arguments
#3302
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3302 +/- ##
==========================================
- Coverage 78.47% 78.41% -0.07%
==========================================
Files 103 103
Lines 141822 141882 +60
==========================================
- Hits 111298 111254 -44
- Misses 30524 30628 +104
Continue to review full report at Codecov.
|
Ozaki Kiichi wrote:
I think current `emsg()` family is complicated.
i.e. emsg(), emsg2(), emsg3(), emsgn(), iemsg(), iemsg2(), iemsg()
This patch proposes to add `emsgf()` and `iemsgf()` which takes printf-like variable arguments,
and remain `emsg()` and `iemsg()` since they can omit formatting strings.
Thanks, it's in line with smsg().
I think we should be able to get rid of EMSG2(), EMSG3() and EMSGN().
Avoids some char_u/char casts and clearer how it works.
…--
I just planted an Algebra tree. It has square roots.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
emsgf()
which can use variable argumentsemsg()
take variable arguments
Updated patch.
|
Ozaki Kiichi wrote:
Updated patch.
* Replace/Rename:
* `emsg()` -> `emsg1()` (1 argument)
* `emsg2()`, `emsg3()`, `emsgn()` -> `emsg()` (variable arguments)
(also `iemsg()` family)
* Remove `EMSG` macro, use `emsg()` directly
For consistency with msg() / smsg() we would have emsg() just take one
"char_u" argument and not use IObuff. And have semsg() use variable
arguments and build the message in IObuff.
…--
hundred-and-one symptoms of being an internet addict:
146. You experience ACTUAL physical withdrawal symptoms when away
from your 'puter and the net.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
Updated patch:
|
Updated patch:
* Rename: emsg2() / emsg3() / emsgn() -> semsg(),
also iemsgX() -> siemsg()
Thanks. Now that we are changing this, it's a good time to make it
consistent. Since semsg() takes a "char *" argument, it's weird that
smsg() takes a "char_u *" argument. While in most places we need a type
cast.
How about making all the emsg() variants take a "char *" argument?
I guess only few type casts are needed then.
If not, then keeping EMSG() as a macro for emsg() with the (char_u *)
type cast would be useful.
…--
hundred-and-one symptoms of being an internet addict:
153. You find yourself staring at your "inbox" waiting for new e-mail
to arrive.
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
fc1efa6
to
d42927e
Compare
Updated patch:
I intended to make consistency with the prototype of msg(). Will it be better to use "char *"? |
Updated patch:
* Use macro `EMSG`/`IEMSG`
> Since semsg() takes a "char *" argument, it's weird that
smsg() takes a "char_u *" argument. While in most places we need a type
cast.
I intended to make consistency with the prototype of msg(). Will it be
better to use "char *"?
When I grep for "smsg" I see that nearly all the calls have a type cast
to (char_u *). Let's change smsg() to use a "char *" argument and also
use that for semsg().
For msg() and emsg() we can use the macros. But it's probably better to
make these use "char *" as well, both for consistency and to avoid the
need for the macros.
…--
Wizards had always known that the act of observation changed the thing that
was observed, and sometimes forgot that it also changed the observer too.
Terry Pratchett - Interesting times
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|
e1ef8e7
to
f9328b2
Compare
* Rename emsgX()/iemsgX() into semsg()/siemsg() and make them take variable arguments * Remove EMSG macro
Currently emsg() takes the argument "char_u *" variable or string literal ("const char *"), so using "char *" argument needs always type cast. Therefore should take "const char *" argument. |
Additionally: I changed the type of smsg() 1st argument to "const char *" |
When making emsg() (and msg()) take "const char *" argument, in their procedures some functions take "char_u *" argument so needs type-cast, a bit complicated. |
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. vim/vim@f9e3e09
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. vim/vim@f9e3e09
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. vim/vim@f9e3e09
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. vim/vim@f9e3e09
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. vim/vim@f9e3e09
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. vim/vim@f9e3e09
I think current
emsg()
family is complicated.i.e. emsg(), emsg2(), emsg3(), emsgn(), iemsg(), iemsg2(), iemsg()
This patch proposes to add
emsgf()
andiemsgf()
which takes printf-like variable arguments,and remain
emsg()
andiemsg()
since they can omit formatting strings.