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
* 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'.
{
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;
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'. */);