* message's docstring
@ 2006-11-12 0:11 Juanma Barranquero
2006-11-12 10:16 ` David Kastrup
2006-11-12 21:12 ` Richard Stallman
0 siblings, 2 replies; 11+ messages in thread
From: Juanma Barranquero @ 2006-11-12 0:11 UTC (permalink / raw)
Two slight inconsistencies/problems in message's docstring:
1) It says:
DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
doc: /* Print a one-line message at the bottom of the screen.
Why "a one-line message"? There's nothing stopping
(message "line 1\nline 2")
for working, or even
(message "%s\n%s" "line1" "line2")
2) The docstring doesn't mention that the message is returned.
However, several modules do rely on it (files.el, for example, has
"(y-or-n-p (message ...))".
It is OK the following change, or there are policy issues here?
/L/e/k/t/u
Index: src/editfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/editfns.c,v
retrieving revision 1.428
diff -u -2 -r1.428 editfns.c
--- src/editfns.c 11 Sep 2006 08:26:47 -0000 1.428
+++ src/editfns.c 11 Nov 2006 23:48:16 -0000
@@ -3172,7 +3172,8 @@
DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
- doc: /* Print a one-line message at the bottom of the screen.
+ doc: /* Print a message at the bottom of the screen.
The message also goes into the `*Messages*' buffer.
\(In keyboard macros, that's all it does.)
+Return the message.
The first argument is a format control string, and the rest are data
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 0:11 message's docstring Juanma Barranquero
@ 2006-11-12 10:16 ` David Kastrup
2006-11-12 12:08 ` Juanma Barranquero
2006-11-13 18:36 ` Kevin Rodgers
2006-11-12 21:12 ` Richard Stallman
1 sibling, 2 replies; 11+ messages in thread
From: David Kastrup @ 2006-11-12 10:16 UTC (permalink / raw)
Cc: emacs- devel
"Juanma Barranquero" <lekktu@gmail.com> writes:
> Two slight inconsistencies/problems in message's docstring:
>
> 1) It says:
>
> DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
> doc: /* Print a one-line message at the bottom of the screen.
>
> Why "a one-line message"? There's nothing stopping
>
> (message "line 1\nline 2")
>
> for working, or even
>
> (message "%s\n%s" "line1" "line2")
>
> 2) The docstring doesn't mention that the message is returned.
> However, several modules do rely on it (files.el, for example, has
> "(y-or-n-p (message ...))".
That sounds nonsensical. Shouldn't this be
(y-or-n-p (format ...))
instead?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 10:16 ` David Kastrup
@ 2006-11-12 12:08 ` Juanma Barranquero
2006-11-12 12:17 ` David Kastrup
2006-11-13 18:36 ` Kevin Rodgers
1 sibling, 1 reply; 11+ messages in thread
From: Juanma Barranquero @ 2006-11-12 12:08 UTC (permalink / raw)
Cc: emacs- devel
On 11/12/06, David Kastrup <dak@gnu.org> wrote:
> That sounds nonsensical. Shouldn't this be
> (y-or-n-p (format ...))
> instead?
Surely yes. But the fact that it did work till now is because message
returns the message string.
So, either we document it, or document that the result is irrelevant
(but it certainly doesn't look so, looking at the code).
/L/e/k/t/u
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 12:08 ` Juanma Barranquero
@ 2006-11-12 12:17 ` David Kastrup
2006-11-12 12:20 ` Juanma Barranquero
0 siblings, 1 reply; 11+ messages in thread
From: David Kastrup @ 2006-11-12 12:17 UTC (permalink / raw)
Cc: emacs-devel
"Juanma Barranquero" <lekktu@gmail.com> writes:
> On 11/12/06, David Kastrup <dak@gnu.org> wrote:
>
>> That sounds nonsensical. Shouldn't this be
>> (y-or-n-p (format ...))
>> instead?
>
> Surely yes. But the fact that it did work till now is because message
> returns the message string.
>
> So, either we document it, or document that the result is irrelevant
> (but it certainly doesn't look so, looking at the code).
But we should let ourselves be governed rather by code working as
intended rather than stuff in need of fixing.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 12:17 ` David Kastrup
@ 2006-11-12 12:20 ` Juanma Barranquero
2006-11-12 12:29 ` David Kastrup
0 siblings, 1 reply; 11+ messages in thread
From: Juanma Barranquero @ 2006-11-12 12:20 UTC (permalink / raw)
Cc: emacs-devel
On 11/12/06, David Kastrup <dak@gnu.org> wrote:
> But we should let ourselves be governed rather by code working as
> intended rather than stuff in need of fixing.
Sorry, I don't understand.
/L/e/k/t/u
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 12:20 ` Juanma Barranquero
@ 2006-11-12 12:29 ` David Kastrup
2006-11-12 12:42 ` Juanma Barranquero
2006-11-13 9:43 ` Richard Stallman
0 siblings, 2 replies; 11+ messages in thread
From: David Kastrup @ 2006-11-12 12:29 UTC (permalink / raw)
Cc: emacs-devel
"Juanma Barranquero" <lekktu@gmail.com> writes:
> On 11/12/06, David Kastrup <dak@gnu.org> wrote:
>
>> But we should let ourselves be governed rather by code working as
>> intended rather than stuff in need of fixing.
>
> Sorry, I don't understand.
We should not try accommodating obvious bugs, but rather fix them. Do
you have any instances where the return value of `message' would
actually get used without `message' being confused for `format'?
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 12:29 ` David Kastrup
@ 2006-11-12 12:42 ` Juanma Barranquero
2006-11-13 9:43 ` Richard Stallman
1 sibling, 0 replies; 11+ messages in thread
From: Juanma Barranquero @ 2006-11-12 12:42 UTC (permalink / raw)
Cc: emacs-devel
On 11/12/06, David Kastrup <dak@gnu.org> wrote:
> We should not try accommodating obvious bugs, but rather fix them. Do
> you have any instances where the return value of `message' would
> actually get used without `message' being confused for `format'?
The one that prompted me to look: in server.el there are cases like
(server-log (message "Restarting server"))
to avoid
(message "Restarting server")
(server-log "Restarting server")
or a `let'. Not earthshaking, but useful.
But, as I said, the intended return of the message in `message' is
*quite* intentional:
if (NILP (args[0])
|| (STRINGP (args[0])
&& SBYTES (args[0]) == 0))
{
message (0);
return args[0];
}
else
{
register Lisp_Object val;
val = Fformat (nargs, args);
message3 (val, SBYTES (val), STRING_MULTIBYTE (val));
return val;
}
I vote for keeping it and documenting it. Is a one-line in the
docstring, and the current behavior is at least fifteen years old.
/L/e/k/t/u
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 12:29 ` David Kastrup
2006-11-12 12:42 ` Juanma Barranquero
@ 2006-11-13 9:43 ` Richard Stallman
1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2006-11-13 9:43 UTC (permalink / raw)
Cc: lekktu, emacs-devel
We should fix the code that calls (y-or-n-p (message ...)),
but let's also document the return value of `message'.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 10:16 ` David Kastrup
2006-11-12 12:08 ` Juanma Barranquero
@ 2006-11-13 18:36 ` Kevin Rodgers
2006-11-13 19:04 ` Juanma Barranquero
1 sibling, 1 reply; 11+ messages in thread
From: Kevin Rodgers @ 2006-11-13 18:36 UTC (permalink / raw)
David Kastrup wrote:
> "Juanma Barranquero" <lekktu@gmail.com> writes:
>> 2) The docstring doesn't mention that the message is returned.
>> However, several modules do rely on it (files.el, for example, has
>> "(y-or-n-p (message ...))".
>
> That sounds nonsensical. Shouldn't this be
> (y-or-n-p (format ...))
> instead?
Perhaps the author wanted the prompt to be recorded in the *Messages*
buffer.
--
Kevin
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: message's docstring
2006-11-12 0:11 message's docstring Juanma Barranquero
2006-11-12 10:16 ` David Kastrup
@ 2006-11-12 21:12 ` Richard Stallman
1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2006-11-12 21:12 UTC (permalink / raw)
Cc: emacs-devel
Please do make your change. In addition, please change "Print" to
"Display".
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2006-11-13 19:04 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-12 0:11 message's docstring Juanma Barranquero
2006-11-12 10:16 ` David Kastrup
2006-11-12 12:08 ` Juanma Barranquero
2006-11-12 12:17 ` David Kastrup
2006-11-12 12:20 ` Juanma Barranquero
2006-11-12 12:29 ` David Kastrup
2006-11-12 12:42 ` Juanma Barranquero
2006-11-13 9:43 ` Richard Stallman
2006-11-13 18:36 ` Kevin Rodgers
2006-11-13 19:04 ` Juanma Barranquero
2006-11-12 21:12 ` Richard Stallman
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.