From: Juri Linkov <juri@jurta.org>
Subject: Re: (message (format "File %s" file))
Date: Tue, 20 Sep 2005 08:11:22 +0300 [thread overview]
Message-ID: <87ek7k5nkb.fsf@jurta.org> (raw)
In-Reply-To: <873bop978p.fsf@gnufans.net> (D. Goel's message of "Wed, 31 Aug 2005 16:33:26 -0400")
> A *lot* of source code contains easy-to-miss bugs like this:
>
> (message (format "File: %s" file))
I guess one of the reasons of such bugs is the misleading argument
name `string' of the function `message'. This name doesn't suggest
that it is actually a format string used by the function `format'.
I propose to rename the argument name `string' to `format-string' in
docstrings of `message...' functions and in the Emacs Lisp Reference
Manual.
Index: src/editfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/editfns.c,v
retrieving revision 1.398
diff -c -r1.398 editfns.c
*** src/editfns.c 19 Sep 2005 08:13:14 -0000 1.398
--- src/editfns.c 20 Sep 2005 05:04:02 -0000
***************
*** 3124,3130 ****
any existing message; this lets the minibuffer contents show. See
also `current-message'.
! usage: (message STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
--- 3124,3130 ----
any existing message; this lets the minibuffer contents show. See
also `current-message'.
! usage: (message FORMAT-STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
***************
*** 3154,3160 ****
If the first argument is nil or the empty string, clear any existing
message; let the minibuffer contents show.
! usage: (message-box STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
--- 3154,3160 ----
If the first argument is nil or the empty string, clear any existing
message; let the minibuffer contents show.
! usage: (message-box FORMAT-STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
***************
*** 3216,3222 ****
If the first argument is nil or the empty string, clear any existing
message; let the minibuffer contents show.
! usage: (message-or-box STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
--- 3216,3222 ----
If the first argument is nil or the empty string, clear any existing
message; let the minibuffer contents show.
! usage: (message-or-box FORMAT-STRING &rest ARGS) */)
(nargs, args)
int nargs;
Lisp_Object *args;
***************
*** 3281,3288 ****
: SBYTES (STRING))
DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
! doc: /* Format a string out of a control-string and arguments.
! The first argument is a control string.
The other arguments are substituted into it to make the result, a string.
It may contain %-sequences meaning to substitute the next argument.
%s means print a string argument. Actually, prints any object, with `princ'.
--- 3281,3288 ----
: SBYTES (STRING))
DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
! doc: /* Format a string out of a format-string and arguments.
! The first argument is a format control string.
The other arguments are substituted into it to make the result, a string.
It may contain %-sequences meaning to substitute the next argument.
%s means print a string argument. Actually, prints any object, with `princ'.
Index: lispref/display.texi
===================================================================
RCS file: /cvsroot/emacs/emacs/lispref/display.texi,v
retrieving revision 1.187
diff -c -r1.187 display.texi
*** lispref/display.texi 18 Sep 2005 14:03:55 -0000 1.187
--- lispref/display.texi 20 Sep 2005 05:02:59 -0000
***************
*** 208,216 ****
This section describes the functions for explicitly producing echo
area messages. Many other Emacs features display messages there, too.
! @defun message string &rest arguments
! This function displays a message in the echo area. The
! argument @var{string} is similar to a C language @code{printf} control
string. See @code{format} in @ref{Formatting Strings}, for the details
on the conversion specifications. @code{message} returns the
constructed string.
--- 208,216 ----
This section describes the functions for explicitly producing echo
area messages. Many other Emacs features display messages there, too.
! @defun message format-string &rest arguments
! This function displays a message in the echo area. The argument
! @var{format-string} is similar to a C language @code{printf} format
string. See @code{format} in @ref{Formatting Strings}, for the details
on the conversion specifications. @code{message} returns the
constructed string.
***************
*** 218,231 ****
In batch mode, @code{message} prints the message text on the standard
error stream, followed by a newline.
! If @var{string}, or strings among the @var{arguments}, have @code{face}
! text properties, these affect the way the message is displayed.
@c Emacs 19 feature
! If @var{string} is @code{nil}, @code{message} clears the echo area; if
! the echo area has been expanded automatically, this brings it back to
! its normal size. If the minibuffer is active, this brings the
! minibuffer contents back onto the screen immediately.
@example
@group
--- 218,232 ----
In batch mode, @code{message} prints the message text on the standard
error stream, followed by a newline.
! If @var{format-string}, or strings among the @var{arguments}, have
! @code{face} text properties, these affect the way the message is displayed.
@c Emacs 19 feature
! If @var{format-string} is @code{nil} or the empty string,
! @code{message} clears the echo area; if the echo area has been
! expanded automatically, this brings it back to its normal size.
! If the minibuffer is active, this brings the minibuffer contents back
! onto the screen immediately.
@example
@group
***************
*** 254,260 ****
the previous echo area contents.
@end defmac
! @defun message-or-box string &rest arguments
This function displays a message like @code{message}, but may display it
in a dialog box instead of the echo area. If this function is called in
a command that was invoked using the mouse---more precisely, if
--- 255,261 ----
the previous echo area contents.
@end defmac
! @defun message-or-box format-string &rest arguments
This function displays a message like @code{message}, but may display it
in a dialog box instead of the echo area. If this function is called in
a command that was invoked using the mouse---more precisely, if
***************
*** 268,274 ****
@code{last-nonmenu-event} to a suitable value around the call.
@end defun
! @defun message-box string &rest arguments
This function displays a message like @code{message}, but uses a dialog
box (or a pop-up menu) whenever that is possible. If it is impossible
to use a dialog box or pop-up menu, because the terminal does not
--- 269,275 ----
@code{last-nonmenu-event} to a suitable value around the call.
@end defun
! @defun message-box format-string &rest arguments
This function displays a message like @code{message}, but uses a dialog
box (or a pop-up menu) whenever that is possible. If it is impossible
to use a dialog box or pop-up menu, because the terminal does not
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2005-09-20 5:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-31 20:33 (message (format "File %s" file)) D Goel
2005-08-31 22:10 ` Stefan Monnier
2005-08-31 22:46 ` D Goel
2005-09-05 14:07 ` Kim F. Storm
2005-09-06 5:29 ` Richard M. Stallman
2005-09-01 15:53 ` Richard M. Stallman
2005-09-20 5:11 ` Juri Linkov [this message]
2005-09-21 6:43 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ek7k5nkb.fsf@jurta.org \
--to=juri@jurta.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.