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: npostavs
Subject: bug#354: "Added (how many lines, bytes?!) to file.txt"
Date: Sat, 01 Apr 2017 00:27:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> --- a/src/fileio.c
>> +++ b/src/fileio.c
>> @@ -5150,12 +5150,13 @@ write_region (Lisp_Object start, Lisp_Object end, 
>> Lisp_Object filename,
>>      }
>>  
>>    if (!auto_saving && !noninteractive)
>> -    message_with_string ((NUMBERP (append)
>> -                      ? "Updated %s"
>> -                      : ! NILP (append)
>> -                      ? "Added to %s"
>> -                      : "Wrote %s"),
>> -                     visit_file, 1);
>> +    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?  (I suppose it must, since
message does nothing but call vmessage.)  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);






reply via email to

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