* bug#26796: 26.0.50; (2 characters) is usually wrong @ 2017-05-06 9:49 Lars Ingebrigtsen 2017-05-06 10:32 ` Eli Zaretskii ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Lars Ingebrigtsen @ 2017-05-06 9:49 UTC (permalink / raw) To: 26796 To reproduce, open a file, type in "á" and save the file. Emacs will now say (if you're a utf-8 kind of person) Wrote ‘/tmp/a’ (2 characters) which is wrong, since there's just one character in the buffer. Perhaps saying "(2 bytes)" will be more helpful? (I'd rather Emacs default to not saying anything about the length of the file saved at all by default, since it's just noise to me (and I'll assume to most people).) In GNU Emacs 26.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.14.5) of 2017-04-24 built on stories Repository revision: a1f93c1dfa53dbe007faa09ab0c6e913e86e3ffe Windowing system distributor 'The X.Org Foundation', version 11.0.11604000 System Description: Debian GNU/Linux 8.7 (jessie) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 9:49 bug#26796: 26.0.50; (2 characters) is usually wrong Lars Ingebrigtsen @ 2017-05-06 10:32 ` Eli Zaretskii 2017-05-06 10:38 ` Lars Ingebrigtsen 2017-05-06 10:45 ` Lars Ingebrigtsen 2017-05-06 12:16 ` npostavs 2017-05-07 1:11 ` Paul Eggert 2 siblings, 2 replies; 15+ messages in thread From: Eli Zaretskii @ 2017-05-06 10:32 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 26796 > From: Lars Ingebrigtsen <larsi@gnus.org> > Date: Sat, 06 May 2017 11:49:55 +0200 > > To reproduce, open a file, type in "á" and save the file. Emacs will > now say (if you're a utf-8 kind of person) > > Wrote ‘/tmp/a’ (2 characters) > > which is wrong, since there's just one character in the buffer. I see "1 characters" here. I think the result depends on who you type the above: if there are two characters, a followed by ́, then the file really has 2 characters, and they are only shown as one on display. Try "C-u C-x =" to see what you have in the buffer. > Perhaps saying "(2 bytes)" will be more helpful? I really doubt that: Emacs users tend to think in terms of characters than in terms of bytes. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 10:32 ` Eli Zaretskii @ 2017-05-06 10:38 ` Lars Ingebrigtsen 2017-05-06 10:45 ` Lars Ingebrigtsen 1 sibling, 0 replies; 15+ messages in thread From: Lars Ingebrigtsen @ 2017-05-06 10:38 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 26796-done Eli Zaretskii <eliz@gnu.org> writes: > I see "1 characters" here. I think the result depends on who you type > the above: if there are two characters, a followed by ́, then the file > really has 2 characters, and they are only shown as one on display. > Try "C-u C-x =" to see what you have in the buffer. No, it was an á, but the problem was instead that I apparently had fumbled and added a newline before saving? Hm. Sorry for the noise; closing. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 10:32 ` Eli Zaretskii 2017-05-06 10:38 ` Lars Ingebrigtsen @ 2017-05-06 10:45 ` Lars Ingebrigtsen 2017-05-06 11:06 ` Eli Zaretskii 1 sibling, 1 reply; 15+ messages in thread From: Lars Ingebrigtsen @ 2017-05-06 10:45 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 26796 Eli Zaretskii <eliz@gnu.org> writes: >> Perhaps saying "(2 bytes)" will be more helpful? > > I really doubt that: Emacs users tend to think in terms of characters > than in terms of bytes. But this is questionable, at least: (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents "~/rms.jpg") (write-region (point-min) (point-max) "/tmp/a.jpg")) Wrote ‘/tmp/a.jpg’ (889 characters) There are no characters in a JPEG file; it's all bytes. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 10:45 ` Lars Ingebrigtsen @ 2017-05-06 11:06 ` Eli Zaretskii 0 siblings, 0 replies; 15+ messages in thread From: Eli Zaretskii @ 2017-05-06 11:06 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 26796 > From: Lars Ingebrigtsen <larsi@gnus.org> > Cc: 26796@debbugs.gnu.org > Date: Sat, 06 May 2017 12:45:45 +0200 > > But this is questionable, at least: > > (with-temp-buffer (set-buffer-multibyte nil) (insert-file-contents "~/rms.jpg") (write-region (point-min) (point-max) "/tmp/a.jpg")) > Wrote ‘/tmp/a.jpg’ (889 characters) > > There are no characters in a JPEG file; it's all bytes. Each byte is a character in this case, right? Anyway, since you don't like this feature, it's clear that you can come up with many examples where you don't like the result. People who do like it will most probably disagree. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 9:49 bug#26796: 26.0.50; (2 characters) is usually wrong Lars Ingebrigtsen 2017-05-06 10:32 ` Eli Zaretskii @ 2017-05-06 12:16 ` npostavs 2017-05-06 14:19 ` Eli Zaretskii 2017-05-07 1:11 ` Paul Eggert 2 siblings, 1 reply; 15+ messages in thread From: npostavs @ 2017-05-06 12:16 UTC (permalink / raw) To: Lars Ingebrigtsen; +Cc: 26796 Lars Ingebrigtsen <larsi@gnus.org> writes: > (I'd rather Emacs default to not saying anything about the length of the > file saved at all by default, since it's just noise to me (and I'll > assume to most people).) Eli Zaretskii <eliz@gnu.org> writes: > Anyway, since you don't like this feature, it's clear that you can > come up with many examples where you don't like the result. People > who do like it will most probably disagree. Actually this reminds I was planning on reverting this feature entirely, I haven't seen anyone say they like it (the bug reporter who initiated this feature never responded: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=354#81) whereas quite a few seem to actively dislike it. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 12:16 ` npostavs @ 2017-05-06 14:19 ` Eli Zaretskii 2017-05-06 17:21 ` npostavs 2017-05-08 5:02 ` Mark Oteiza 0 siblings, 2 replies; 15+ messages in thread From: Eli Zaretskii @ 2017-05-06 14:19 UTC (permalink / raw) To: npostavs; +Cc: larsi, 26796 > From: npostavs@users.sourceforge.net > Date: Sat, 06 May 2017 08:16:53 -0400 > Cc: 26796@debbugs.gnu.org > > Actually this reminds I was planning on reverting this feature entirely, Since it's already implemented, maybe just make it optional, by default off. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 14:19 ` Eli Zaretskii @ 2017-05-06 17:21 ` npostavs 2017-05-08 5:02 ` Mark Oteiza 1 sibling, 0 replies; 15+ messages in thread From: npostavs @ 2017-05-06 17:21 UTC (permalink / raw) To: Eli Zaretskii; +Cc: larsi, 26796 Eli Zaretskii <eliz@gnu.org> writes: >> From: npostavs@users.sourceforge.net >> Date: Sat, 06 May 2017 08:16:53 -0400 >> Cc: 26796@debbugs.gnu.org >> >> Actually this reminds I was planning on reverting this feature entirely, > > Since it's already implemented, maybe just make it optional, by > default off. I'm not sure the added complexity is worth it for a feature that probably nobody will bother using... ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 14:19 ` Eli Zaretskii 2017-05-06 17:21 ` npostavs @ 2017-05-08 5:02 ` Mark Oteiza 2017-05-08 14:33 ` Eli Zaretskii 1 sibling, 1 reply; 15+ messages in thread From: Mark Oteiza @ 2017-05-08 5:02 UTC (permalink / raw) To: Eli Zaretskii; +Cc: larsi, 26796, npostavs Eli Zaretskii <eliz@gnu.org> writes: >> From: npostavs@users.sourceforge.net >> Date: Sat, 06 May 2017 08:16:53 -0400 >> Cc: 26796@debbugs.gnu.org >> >> Actually this reminds I was planning on reverting this feature entirely, > > Since it's already implemented, maybe just make it optional, by > default off. Was there any reason to implement it in the first place? ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-08 5:02 ` Mark Oteiza @ 2017-05-08 14:33 ` Eli Zaretskii 2017-05-08 15:59 ` Glenn Morris 0 siblings, 1 reply; 15+ messages in thread From: Eli Zaretskii @ 2017-05-08 14:33 UTC (permalink / raw) To: Mark Oteiza; +Cc: larsi, 26796, npostavs > From: Mark Oteiza <mvoteiza@udel.edu> > Cc: npostavs@users.sourceforge.net, larsi@gnus.org, 26796@debbugs.gnu.org > Date: Mon, 08 May 2017 01:02:27 -0400 > > Was there any reason to implement it in the first place? Seems we are back at the discussion we had starting here: http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00219.html ;-) ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-08 14:33 ` Eli Zaretskii @ 2017-05-08 15:59 ` Glenn Morris 2017-05-08 16:07 ` Eli Zaretskii 2017-05-09 4:39 ` npostavs 0 siblings, 2 replies; 15+ messages in thread From: Glenn Morris @ 2017-05-08 15:59 UTC (permalink / raw) To: Eli Zaretskii; +Cc: Mark Oteiza, larsi, 26796, npostavs Eli Zaretskii wrote: >> Was there any reason to implement it in the first place? > > Seems we are back at the discussion we had starting here: > > http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00219.html In which, if I read right, literally no-one was in favour of the feature? A feature that several people have now spent time debugging, tweaking, and documenting, and which will have to be supported going forwards. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-08 15:59 ` Glenn Morris @ 2017-05-08 16:07 ` Eli Zaretskii 2017-05-09 0:41 ` Mark Oteiza 2017-05-09 4:39 ` npostavs 1 sibling, 1 reply; 15+ messages in thread From: Eli Zaretskii @ 2017-05-08 16:07 UTC (permalink / raw) To: Glenn Morris; +Cc: mvoteiza, larsi, 26796, npostavs > From: Glenn Morris <rgm@gnu.org> > Cc: Mark Oteiza <mvoteiza@udel.edu>, larsi@gnus.org, 26796@debbugs.gnu.org, npostavs@users.sourceforge.net > Date: Mon, 08 May 2017 11:59:52 -0400 > > Eli Zaretskii wrote: > > >> Was there any reason to implement it in the first place? > > > > Seems we are back at the discussion we had starting here: > > > > http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00219.html > > In which, if I read right, literally no-one was in favour of the feature? > A feature that several people have now spent time debugging, tweaking, > and documenting, and which will have to be supported going forwards. Is this a complaint about something I did? Just wondering. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-08 16:07 ` Eli Zaretskii @ 2017-05-09 0:41 ` Mark Oteiza 0 siblings, 0 replies; 15+ messages in thread From: Mark Oteiza @ 2017-05-09 0:41 UTC (permalink / raw) To: Eli Zaretskii; +Cc: larsi, 26796, npostavs On 08/05/17 at 07:07pm, Eli Zaretskii wrote: > > From: Glenn Morris <rgm@gnu.org> > > Cc: Mark Oteiza <mvoteiza@udel.edu>, larsi@gnus.org, 26796@debbugs.gnu.org, npostavs@users.sourceforge.net > > Date: Mon, 08 May 2017 11:59:52 -0400 > > > > Eli Zaretskii wrote: > > > > >> Was there any reason to implement it in the first place? > > > > > > Seems we are back at the discussion we had starting here: > > > > > > http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00219.html > > > > In which, if I read right, literally no-one was in favour of the feature? > > A feature that several people have now spent time debugging, tweaking, > > and documenting, and which will have to be supported going forwards. > > Is this a complaint about something I did? Just wondering. I'm just here to complain that everything stemming from this change, including the bikeshedding about if and how filenames in the message should be quoted (which is just more waste of space) hasn't been reverted yet. ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-08 15:59 ` Glenn Morris 2017-05-08 16:07 ` Eli Zaretskii @ 2017-05-09 4:39 ` npostavs 1 sibling, 0 replies; 15+ messages in thread From: npostavs @ 2017-05-09 4:39 UTC (permalink / raw) To: Glenn Morris; +Cc: Mark Oteiza, larsi, 26796 unarchive 354 tags 354 = wontfix quit Glenn Morris <rgm@gnu.org> writes: > Eli Zaretskii wrote: > >>> Was there any reason to implement it in the first place? >> >> Seems we are back at the discussion we had starting here: >> >> http://lists.gnu.org/archive/html/emacs-devel/2017-04/msg00219.html > > In which, if I read right, literally no-one was in favour of the feature? > A feature that several people have now spent time debugging, tweaking, > and documenting, and which will have to be supported going forwards. My only defence is that everyone seemed to think it was a good idea *before* I merged it. In hindsight I should have reverted this much sooner, but anyway, it's done now [1: daaec72a82]. [1: daaec72a82]: 2017-05-08 23:28:32 -0400 Revert "Output number of characters added to file (Bug#354)" http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=daaec72a82e76f916e639acb51a8ad602433e8a9 ^ permalink raw reply [flat|nested] 15+ messages in thread
* bug#26796: 26.0.50; (2 characters) is usually wrong 2017-05-06 9:49 bug#26796: 26.0.50; (2 characters) is usually wrong Lars Ingebrigtsen 2017-05-06 10:32 ` Eli Zaretskii 2017-05-06 12:16 ` npostavs @ 2017-05-07 1:11 ` Paul Eggert 2 siblings, 0 replies; 15+ messages in thread From: Paul Eggert @ 2017-05-07 1:11 UTC (permalink / raw) To: 26796; +Cc: larsi, npostavs [-- Attachment #1: Type: text/plain, Size: 229 bytes --] Appending " (NNNN characters)" to the "Wrote FOO" messages appears to be unpopular and at times confusing. At least it should be off by default, so I installed the attached. It'd be fine with me if we removed them entirely. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-New-var-write-region-verbose-default-nil.patch --] [-- Type: text/x-diff; name="0001-New-var-write-region-verbose-default-nil.patch", Size: 4475 bytes --] From 33c96bacd656cffeedf32038686c0ea99b7c411b Mon Sep 17 00:00:00 2001 From: Paul Eggert <eggert@cs.ucla.edu> Date: Sat, 6 May 2017 18:00:23 -0700 Subject: [PATCH] New var write-region-verbose, default nil By popular demand, write-region char counts are now off by default (Bug#26796). * src/fileio.c (write-region-verbose): New Lisp var. (write_region): Output char count only if the var is non-nil. * doc/emacs/files.texi (Misc File Ops), etc/NEWS: Document this. --- doc/emacs/files.texi | 7 ++++--- etc/NEWS | 6 +++--- src/fileio.c | 34 +++++++++++++++++++++++----------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index bc977b7..d36fe65 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1657,9 +1657,10 @@ Misc File Ops copies the contents of the region into the specified file. @kbd{M-x append-to-file} adds the text of the region to the end of the specified file. @xref{Accumulating Text}. When called interactively, -these commands will print a message in the echo area giving the name -of the file affected as well as the number of characters which were -added. The variable @code{write-region-inhibit-fsync} applies to +these commands print a message in the echo area giving the name +of the file affected; if the variable @code{write-region-verbose} is +non-nil the message also reports the number of characters written. +The variable @code{write-region-inhibit-fsync} applies to these commands, as well as saving files; see @ref{Customize Save}. @findex set-file-modes diff --git a/etc/NEWS b/etc/NEWS index 2918c6e..1f1f4b4 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -94,9 +94,9 @@ required capabilities are found in terminfo. See the FAQ node * Changes in Emacs 26.1 +++ -** The functions write-region, append-to-file, and the like now output -the number of characters added in addition to the name of the file -affected. +** The functions write-region, append-to-file, and the like now also +output the number of characters added in addition to the name of the +file affected, if the new variable 'write-region-verbose' is non-nil. ** The variable 'emacs-version' no longer includes the build number. This is now stored separately in a new variable, 'emacs-build-number'. diff --git a/src/fileio.c b/src/fileio.c index ad5ab61..6138bfc 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5153,17 +5153,24 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, { EMACS_INT nchars = (STRINGP (start) ? SCHARS (start) : XINT (end) - XINT (start)); - AUTO_STRING (format, NUMBERP (append) - ? (nchars != 1 - ? "Updated `%s' (%d characters)" - : "Updated `%s' (%d character)") - : ! NILP (append) - ? (nchars != 1 - ? "Added to `%s' (%d characters)" - : "Added to `%s' (%d character)") - : (nchars != 1 - ? "Wrote `%s' (%d characters)" - : "Wrote `%s' (%d character)")); + AUTO_STRING (format, + (NUMBERP (append) + ? (NILP (Vwrite_region_verbose) + ? "Updated `%s'" + : nchars == 1 + ? "Updated `%s' (1 character)" + : "Updated `%s' (%d characters)") + : ! NILP (append) + ? (NILP (Vwrite_region_verbose) + ? "Added to `%s'" + : nchars == 1 + ? "Added to `%s' (1 character)" + : "Added to `%s' (%d characters)") + : (NILP (Vwrite_region_verbose) + ? "Wrote `%s'" + : nchars == 1 + ? "Wrote `%s' (1 character)" + : "Wrote `%s' (%d characters)"))); CALLN (Fmessage, format, visit_file, make_number (nchars)); } return Qnil; @@ -6135,6 +6142,11 @@ These are the annotations made by other annotation functions that were already called. See also `write-region-annotate-functions'. */); Vwrite_region_annotations_so_far = Qnil; + DEFVAR_LISP ("write-region-verbose", + Vwrite_region_verbose, + doc: /* If non-nil, be more verbose when writing a region. */); + Vwrite_region_verbose = Qnil; + DEFVAR_LISP ("inhibit-file-name-handlers", Vinhibit_file_name_handlers, doc: /* A list of file name handlers that temporarily should not be used. This applies only to the operation `inhibit-file-name-operation'. */); -- 2.7.4 ^ permalink raw reply related [flat|nested] 15+ messages in thread
end of thread, other threads:[~2017-05-09 4:39 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-05-06 9:49 bug#26796: 26.0.50; (2 characters) is usually wrong Lars Ingebrigtsen 2017-05-06 10:32 ` Eli Zaretskii 2017-05-06 10:38 ` Lars Ingebrigtsen 2017-05-06 10:45 ` Lars Ingebrigtsen 2017-05-06 11:06 ` Eli Zaretskii 2017-05-06 12:16 ` npostavs 2017-05-06 14:19 ` Eli Zaretskii 2017-05-06 17:21 ` npostavs 2017-05-08 5:02 ` Mark Oteiza 2017-05-08 14:33 ` Eli Zaretskii 2017-05-08 15:59 ` Glenn Morris 2017-05-08 16:07 ` Eli Zaretskii 2017-05-09 0:41 ` Mark Oteiza 2017-05-09 4:39 ` npostavs 2017-05-07 1:11 ` Paul Eggert
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).