diff options
-rw-r--r-- | doc/emacs/files.texi | 9 | ||||
-rw-r--r-- | etc/NEWS | 5 | ||||
-rw-r--r-- | lisp/epa-file.el | 5 | ||||
-rw-r--r-- | lisp/gnus/mm-util.el | 2 | ||||
-rw-r--r-- | lisp/jka-compr.el | 5 | ||||
-rw-r--r-- | lisp/net/ange-ftp.el | 5 | ||||
-rw-r--r-- | lisp/net/tramp-adb.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-gvfs.el | 3 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 3 | ||||
-rw-r--r-- | lisp/net/tramp-smb.el | 3 | ||||
-rw-r--r-- | lisp/net/tramp.el | 21 | ||||
-rw-r--r-- | src/fileio.c | 35 | ||||
-rw-r--r-- | test/lisp/net/tramp-tests.el | 54 |
13 files changed, 21 insertions, 131 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index d36fe6541ed..5e6afa5506f 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1656,12 +1656,9 @@ similar to the @kbd{M-x find-file-literally} command @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}. When called interactively, -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}. +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}. @findex set-file-modes @cindex file modes @@ -93,11 +93,6 @@ 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 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/lisp/epa-file.el b/lisp/epa-file.el index 64e00e0aba4..c97acb837aa 100644 --- a/lisp/epa-file.el +++ b/lisp/epa-file.el @@ -290,10 +290,7 @@ If no one is selected, symmetric encryption will be performed. " (if (or (eq visit t) (eq visit nil) (stringp visit)) - (message "Wrote `%s' (%d characters)" buffer-file-name - (cond ((null start) (buffer-size)) - ((stringp start) (length start)) - (t (- end start))))))) + (message "Wrote %s" buffer-file-name)))) (put 'write-region 'epa-file 'epa-file-write-region) (defun epa-file-select-keys () diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index f4e79e53731..89f397e3ed0 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el @@ -736,7 +736,7 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." inhibit-file-name-handlers) inhibit-file-name-handlers))) (write-region start end filename t 'no-message) - (message "Appended to `%s' (%d characters)" filename (- end start)))) + (message "Appended to %s" filename))) (defun mm-write-region (start end filename &optional append visit lockname coding-system inhibit) diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el index e4f7348c81a..26a7cf506fd 100644 --- a/lisp/jka-compr.el +++ b/lisp/jka-compr.el @@ -357,10 +357,7 @@ There should be no more than seven characters after the final `/'." (and (or (eq visit t) (eq visit nil) (stringp visit)) - (message "Wrote `%s' (%d characters)" visit-file - (cond ((null start) (buffer-size)) - ((stringp start) (length start)) - (t (- end start))))) + (message "Wrote %s" visit-file)) ;; ensure `last-coding-system-used' has an appropriate value (setq last-coding-system-used coding-system-used) diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el index 7b8b3fc8809..ecb60e5a4f4 100644 --- a/lisp/net/ange-ftp.el +++ b/lisp/net/ange-ftp.el @@ -3284,10 +3284,7 @@ system TYPE.") (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' (%d characters)" abbr - (cond ((null start) (buffer-size)) - ((stringp start) (length start)) - (t (- end start)))) + (ange-ftp-message "Wrote %s" abbr) (ange-ftp-add-file-entry filename)) (ange-ftp-real-write-region start end filename append visit)))) diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 8bbdca795e8..2825532c525 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -652,8 +652,6 @@ But handle the case, if the \"test\" command is not available." (when (or (eq visit t) (stringp visit)) (set-visited-file-modtime)) - (tramp-handle-write-region-message v start end filename append visit) - (unless (equal curbuf (current-buffer)) (tramp-error v 'file-error diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 55fddf3dbd8..cf3906aef36 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1224,7 +1224,8 @@ file-notify events." (file-attributes filename)))) ;; The end. - (tramp-handle-write-region-message v start end filename append visit) + (when (or (eq visit t) (null visit) (stringp visit)) + (tramp-message v 0 "Wrote %s" filename)) (run-hooks 'tramp-handle-write-region-hook))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index adadf9650e6..e61b0ce526a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3412,7 +3412,8 @@ the result will be a local, non-Tramp, file name." ;; Set the ownership. (when need-chown (tramp-set-file-uid-gid filename uid gid)) - (tramp-handle-write-region-message v start end filename append visit) + (when (or (eq visit t) (null visit) (stringp visit)) + (tramp-message v 0 "Wrote %s" filename)) (run-hooks 'tramp-handle-write-region-hook))))) (defvar tramp-vc-registered-file-names nil diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 4b288e199af..12eb3679513 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1521,8 +1521,7 @@ errors for shares like \"C$/\", which are common in Microsoft Windows." v 'file-error "Buffer has changed from `%s' to `%s'" curbuf (current-buffer))) (when (eq visit t) - (set-visited-file-modtime)) - (tramp-handle-write-region-message v start end filename append visit)))) + (set-visited-file-modtime))))) ;; Internal file name functions. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4a1900c6f8a..071114a0157 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2753,27 +2753,6 @@ User is always nil." (defvar tramp-handle-write-region-hook nil "Normal hook to be run at the end of `tramp-*-handle-write-region'.") -(defsubst tramp-handle-write-region-message - (vec start end filename &optional append visit) - "Message to be written for `tramp-*-handle-write-region'" - ;; We shall also don't write when autosaving. How to check? - (when (and (null noninteractive) - (or (eq visit t) (null visit) (stringp visit))) - (let ((nchars (cond ((null start) (buffer-size)) - ((stringp start) (length start)) - (t (- end start))))) - (tramp-message - vec 0 "%s `%s'%s" - (cond - ((numberp append) "Updated") - (append "Added to") - (t "Wrote")) - filename - (cond - ((null (bound-and-true-p write-region-verbose)) "") - ((= nchars 1) " (1 character)") - (t (format " (%d characters)" nchars))))))) - (defun tramp-handle-directory-file-name (directory) "Like `directory-file-name' for Tramp files." ;; If localname component of filename is "/", leave it unchanged. diff --git a/src/fileio.c b/src/fileio.c index 6138bfc68bb..acbf76e0d81 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5150,29 +5150,13 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, } if (!auto_saving && !noninteractive) - { - EMACS_INT nchars = (STRINGP (start) ? SCHARS (start) - : XINT (end) - XINT (start)); - 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)); - } + message_with_string ((NUMBERP (append) + ? "Updated %s" + : ! NILP (append) + ? "Added to %s" + : "Wrote %s"), + visit_file, 1); + return Qnil; } @@ -6142,11 +6126,6 @@ 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'. */); diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 742bdfd9348..8db54979b6d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -39,7 +39,6 @@ (require 'dired) (require 'ert) -(require 'ert-x) (require 'tramp) (require 'vc) (require 'vc-bzr) @@ -81,9 +80,6 @@ (when (getenv "NIX_STORE") (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) -(defvar tramp--test-messages nil - "Captured messages from *Messages* buffer.") - (defvar tramp--test-expensive-test (null (string-equal (getenv "SELECTOR") "(quote (not (tag :expensive-test)))")) @@ -1745,77 +1741,31 @@ This checks also `file-name-as-directory', `file-name-directory', (skip-unless (tramp--test-enabled)) (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) - (let* ((tmp-name (tramp--test-make-temp-name nil quoted)) - (text-quoting-style 'grave) - (write-region-verbose - (and (null noninteractive) (boundp 'write-region-verbose))) - (tramp-message-show-message - (or tramp-message-show-message write-region-verbose))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) (unwind-protect - (ert-with-message-capture tramp--test-messages - ;; Write buffer. - (setq tramp--test-messages "") + (progn (with-temp-buffer (insert "foo") (write-region nil nil tmp-name)) - (when write-region-verbose - (should - (string-match - (format "Wrote `%s' (3 characters)" tmp-name) - tramp--test-messages))) (with-temp-buffer (insert-file-contents tmp-name) (should (string-equal (buffer-string) "foo"))) - ;; Append. - (setq tramp--test-messages "") (with-temp-buffer (insert "bla") (write-region nil nil tmp-name 'append)) - (when write-region-verbose - (should - (string-match - (format "Added to `%s' (3 characters)" tmp-name) - tramp--test-messages))) (with-temp-buffer (insert-file-contents tmp-name) (should (string-equal (buffer-string) "foobla"))) - - (setq tramp--test-messages "") - (with-temp-buffer - (insert "baz") - (write-region nil nil tmp-name 3)) - (when write-region-verbose - (should - (string-match - (format "Updated `%s' (3 characters)" tmp-name) - tramp--test-messages))) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foobaz"))) - ;; Write string. - (setq tramp--test-messages "") (write-region "foo" nil tmp-name) - (when write-region-verbose - (should - (string-match - (format "Wrote `%s' (3 characters)" tmp-name) - tramp--test-messages))) (with-temp-buffer (insert-file-contents tmp-name) (should (string-equal (buffer-string) "foo"))) - ;; Write partly. - (setq tramp--test-messages "") (with-temp-buffer (insert "123456789") (write-region 3 5 tmp-name)) - (when write-region-verbose - (should - (string-match - (format "Wrote `%s' (2 characters)" tmp-name) - tramp--test-messages))) (with-temp-buffer (insert-file-contents tmp-name) (should (string-equal (buffer-string) "34")))) |