From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: (message (format "File %s" file)) Date: Tue, 20 Sep 2005 08:11:22 +0300 Organization: JURTA Message-ID: <87ek7k5nkb.fsf@jurta.org> References: <873bop978p.fsf@gnufans.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1127194292 28466 80.91.229.2 (20 Sep 2005 05:31:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 20 Sep 2005 05:31:32 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 20 07:31:26 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EHaiE-00042E-BW for ged-emacs-devel@m.gmane.org; Tue, 20 Sep 2005 07:30:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHaiD-0005MM-Jv for ged-emacs-devel@m.gmane.org; Tue, 20 Sep 2005 01:30:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EHagx-0004ij-OV for emacs-devel@gnu.org; Tue, 20 Sep 2005 01:29:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EHagt-0004g6-Ct for emacs-devel@gnu.org; Tue, 20 Sep 2005 01:29:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EHagt-0004fi-2a for emacs-devel@gnu.org; Tue, 20 Sep 2005 01:29:15 -0400 Original-Received: from [194.126.101.111] (helo=mail.neti.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EHag1-0006h1-NA for emacs-devel@gnu.org; Tue, 20 Sep 2005 01:28:22 -0400 Original-Received: from mail.neti.ee (80-235-35-151-dsl.mus.estpak.ee [80.235.35.151]) by Relayhost1.neti.ee (Postfix) with ESMTP id 79D661F6C for ; Tue, 20 Sep 2005 08:28:31 +0300 (EEST) Original-To: emacs-devel@gnu.org In-Reply-To: <873bop978p.fsf@gnufans.net> (D. Goel's message of "Wed, 31 Aug 2005 16:33:26 -0400") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43092 Archived-At: > 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/