From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#354: "Added (how many lines, bytes?!) to file.txt" Date: Sat, 01 Apr 2017 00:27:40 -0400 Message-ID: <87mvc021mr.fsf@users.sourceforge.net> References: <54F01AE2.8050406@cs.ucla.edu> <87y4njzckz.fsf@gmail.com> <87fuig7jxo.fsf@users.sourceforge.net> <83h92vc0op.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1491020836 3965 195.159.176.226 (1 Apr 2017 04:27:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Apr 2017 04:27:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: 354@debbugs.gnu.org, kb1vqh@gmail.com, eggert@cs.ucla.edu To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 01 06:27:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuAd1-0000As-0d for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Apr 2017 06:27:07 +0200 Original-Received: from localhost ([::1]:43881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuAd6-0002bI-Qs for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Apr 2017 00:27:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuAd1-0002bC-6E for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2017 00:27:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuAcw-000899-9L for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2017 00:27:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuAcw-000890-5X for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2017 00:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cuAcv-0007dy-Px for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2017 00:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Apr 2017 04:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 354 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 354-submit@debbugs.gnu.org id=B354.149102078629303 (code B ref 354); Sat, 01 Apr 2017 04:27:01 +0000 Original-Received: (at 354) by debbugs.gnu.org; 1 Apr 2017 04:26:26 +0000 Original-Received: from localhost ([127.0.0.1]:54944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuAcM-0007cZ-FL for submit@debbugs.gnu.org; Sat, 01 Apr 2017 00:26:26 -0400 Original-Received: from mail-it0-f65.google.com ([209.85.214.65]:36178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuAcK-0007cI-G1 for 354@debbugs.gnu.org; Sat, 01 Apr 2017 00:26:24 -0400 Original-Received: by mail-it0-f65.google.com with SMTP id 190so3775371itm.3 for <354@debbugs.gnu.org>; Fri, 31 Mar 2017 21:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XXQMVfP4On0eo4t1h/DKD3i6l7z1MKzOodlGUWNhHkI=; b=itlv+aKhmMefhKaJWeKuRDy55YFHJD23qwAOeUfC1wFHu8Ffy1Cik6j+H93FtlDziS r8WAj0oCvK+4ebxYW5IY5jSjq2fjhgMk+OUJFHsrMebIBmqXFuRdJ3sr86+QHPMoIAQ6 OKSVfuzQ5nsGYe2Mk0N+0ZUiCXlB2Kx+w0zMUyB3aotygEDNylb8azVpGWltmTl96fpJ Sx7rrs4vQ59J+2mSdDMglgW2clg6xx1oDR9iLZP+OoFiEjmISWLwzKY5IFIOPDe6H7tI Fl+qLfY+nky/nJQ7K8iUwVxqBp/Rhspgepm1VdDbo67Wvw/Hnia0fGYklokWRp5RdGJ+ CDYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=XXQMVfP4On0eo4t1h/DKD3i6l7z1MKzOodlGUWNhHkI=; b=r8z5INUtAZZ4JQRMJy365nxLEuR4wcnRieNWxEs5FyfUBe8k9QRZoYnQde8ufbiZ7G /cMyOdR2GlqcpJ6DkXMuN9Sl56Lzt3uuUxnwDY9Y909YJ1KNFhRJbnp86CpaIWZiA/kF e+DbxiazqmkEbrTuSHNMUMwwc9WWzv3JWjq2YOPSzT64Lj5QGUfe21DkxpmCKD+JWs3h fifBbpYl5TKCHHCcRRS80Cn5LCzA72+djilmdkTHvdK9P4xu8ZLWkkYyBtkgrBDkDPDh R6v0L5vJfctYvoEMcAntC7scgEhcipLyubeTj/Mz5rbJLjZDkiYEqJs+tyy1fqDQJt1a PYlA== X-Gm-Message-State: AFeK/H1pqb2nLvYmNewrMPzYT+dIGj+PZBRJPTR87QfrBd900V4M22vd1olmcz66gIpInw== X-Received: by 10.36.51.18 with SMTP id k18mr1253631itk.41.1491020778855; Fri, 31 Mar 2017 21:26:18 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id y21sm4320052ioi.0.2017.03.31.21.26.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Mar 2017 21:26:18 -0700 (PDT) In-Reply-To: <83h92vc0op.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 14 Mar 2017 17:55:50 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:131151 Archived-At: Eli Zaretskii 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);