unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Eli Zaretskii <eliz@gnu.org>
Cc: 354@debbugs.gnu.org, kb1vqh@gmail.com, eggert@cs.ucla.edu
Subject: bug#354: "Added (how many lines, bytes?!) to file.txt"
Date: Sat, 01 Apr 2017 00:27:40 -0400	[thread overview]
Message-ID: <87mvc021mr.fsf@users.sourceforge.net> (raw)
In-Reply-To: <83h92vc0op.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 14 Mar 2017 17:55:50 +0200")

Eli Zaretskii <eliz@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);






  reply	other threads:[~2017-04-01  4:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-03 18:37 bug#354: "Added (how many lines, bytes?!) to file.txt" jidanni
2008-06-03 21:07 ` Stefan Monnier
2008-06-06  4:02 ` Kevin Rodgers
2008-06-06 14:56   ` Drew Adams
2015-02-27  7:21 ` Paul Eggert
2015-02-27 13:52   ` Jeff Clough
2017-03-14  0:58     ` npostavs
2017-03-14 15:55       ` Eli Zaretskii
2017-04-01  4:27         ` npostavs [this message]
2017-04-01  6:09           ` Eli Zaretskii
2017-04-02  3:55             ` npostavs
2017-04-02  6:16               ` Andreas Schwab
2017-04-02 16:10                 ` npostavs
2017-04-02 15:52               ` Eli Zaretskii
2017-04-02 18:24               ` Paul Eggert
2017-04-02 18:40                 ` npostavs
2017-04-02 18:44                   ` Paul Eggert
2017-04-02 19:09                     ` npostavs
2017-04-07  2:27                       ` npostavs
2017-04-10  2:17 ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvc021mr.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=354@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=kb1vqh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).