bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#354: "Added (how many lines, bytes?!) to file.txt"


From: Eli Zaretskii
Subject: bug#354: "Added (how many lines, bytes?!) to file.txt"
Date: Sat, 01 Apr 2017 09:09:04 +0300

> From: address@hidden
> Cc: address@hidden,  address@hidden,  address@hidden
> Date: Sat, 01 Apr 2017 00:27:40 -0400
> 
> >> +    message ((NUMBERP (append)
> >> +              ? "Updated %"pI"d characters of %s"
> >> +              : ! NILP (append)
> >> +              ? "Added %"pI"d characters to %s"
> >> +              : "Wrote %"pI"d characters to %s"),
> >> +             XINT (end) - XINT (start),
> >> +             SDATA (ENCODE_SYSTEM (visit_file)));
> >
> > It is incorrect to use ENCODE_SYSTEM here: the file name should be
> > output with no changes.  That's because 'message' normally displays in
> > the echo area, where the file name should appear unencoded.  What is
> > needed here is to pass to 'message' an encoded file name in
> > non-interactive case, and the original one in the interactive case.
> 
> Actually, we don't print anything in the non-interactive case, so there
> is no need to worry about that.  But I guess the problem here is this
> comment on vmessage:
> 
>    The message must be safe ASCII and the format must not contain ` or
>    '.  If your message and format do not fit into this category,
>    convert your arguments to Lisp objects and use Fmessage instead.  */
> 
> This applies to message as well, correct?

Yes, but only because of the non-interactive case.  If that is not an
issue, you could simply pass the SDATA of the original string, because
we simply insert that into an echo-area buffer.

It might be a good idea to have a similar comment to 'message'.

> So we need to use Fmessage to be able to print the file name.  Like
> this?
> 
>   if (!auto_saving && !noninteractive)
>     Fmessage (build_string ("%s %d characters of %s"),
>               build_string (NUMBERP (append) ? "Updated"
>                             : ! NILP (append) ? "Added"
>                             : "Wrote"),
>               make_number (XINT (end) - XINT (start)),
>               visit_file);

Yes, this is also okay.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]