GNU bug report logs - #354
"Added (how many lines, bytes?!) to file.txt"

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Tue, 3 Jun 2008 20:30:07 UTC

Severity: wishlist

Tags: wontfix

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 354 <at> debbugs.gnu.org, kb1vqh <at> gmail.com, eggert <at> cs.ucla.edu
Subject: bug#354: "Added (how many lines, bytes?!) to file.txt"
Date: Sat, 01 Apr 2017 00:27:40 -0400
Eli Zaretskii <eliz <at> gnu.org> 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);





This bug report was last modified 8 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.