@kbd{M-x write-region} is the inverse of @kbd{M-x insert-file}; it
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}. The variable
-@code{write-region-inhibit-fsync} applies to these commands, as well
-as saving files; see @ref{Customize Save}.
+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, as well as saving files; see @ref{Customize Save}.
@findex set-file-modes
@cindex file modes
\f
* 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 variable 'emacs-version' no longer includes the build number.
This is now stored separately in a new variable, 'emacs-build-number'.
(if (or (eq visit t)
(eq visit nil)
(stringp visit))
- (message "Wrote %s" buffer-file-name))))
+ (message "Wrote %d characters to `%s'" (- end start) buffer-file-name))))
(put 'write-region 'epa-file 'epa-file-write-region)
(defun epa-file-select-keys ()
inhibit-file-name-handlers)
inhibit-file-name-handlers)))
(write-region start end filename t 'no-message)
- (message "Appended to %s" filename)))
+ (message "Appended %d characters to `%s'" (- end start) filename)))
(defun mm-write-region (start end filename &optional append visit lockname
coding-system inhibit)
(and (or (eq visit t)
(eq visit nil)
(stringp visit))
- (message "Wrote %s" visit-file))
+ (message "Wrote %d characters to `%s'" (- end start) visit-file))
;; ensure `last-coding-system-used' has an appropriate value
(setq last-coding-system-used coding-system-used)
(set-buffer-modified-p nil)))
;; ensure `last-coding-system-used' has an appropriate value
(setq last-coding-system-used coding-system-used)
- (ange-ftp-message "Wrote %s" abbr)
+ (ange-ftp-message "Wrote %d characters to `%s'" (- end start) abbr)
(ange-ftp-add-file-entry filename))
(ange-ftp-real-write-region start end filename append visit))))
;; The end.
(when (or (eq visit t) (null visit) (stringp visit))
- (tramp-message v 0 "Wrote %s" filename))
+ (tramp-message v 0 "Wrote %d characters to `%s'" (- end start) filename))
(run-hooks 'tramp-handle-write-region-hook)))
\f
(when need-chown
(tramp-set-file-uid-gid filename uid gid))
(when (or (eq visit t) (null visit) (stringp visit))
- (tramp-message v 0 "Wrote %s" filename))
+ (tramp-message v 0 "Wrote %d characters to `%s'"
+ (- end start) filename))
(run-hooks 'tramp-handle-write-region-hook)))))
(defvar tramp-vc-registered-file-names nil
}
if (!auto_saving && !noninteractive)
- message_with_string ((NUMBERP (append)
- ? "Updated %s"
- : ! NILP (append)
- ? "Added to %s"
- : "Wrote %s"),
- visit_file, 1);
-
+ {
+ AUTO_STRING (format, NUMBERP (append)
+ ? "Updated %d characters of `%s'"
+ : ! NILP (append)
+ ? "Added %d characters to `%s'"
+ : "Wrote %d characters to `%s'");
+ CALLN (Fmessage, format,
+ make_number (XINT (end) - XINT (start)),
+ visit_file);
+ }
return Qnil;
}
\f