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.
This commit is contained in:
parent
7f3d63908c
commit
c311b8b15e
3 changed files with 30 additions and 17 deletions
|
@ -1657,9 +1657,10 @@ similar to the @kbd{M-x find-file-literally} command
|
|||
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
|
||||
|
|
6
etc/NEWS
6
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'.
|
||||
|
|
34
src/fileio.c
34
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'. */);
|
||||
|
|
Loading…
Add table
Reference in a new issue