Commit c3236593 authored by Noam Postavsky's avatar Noam Postavsky

Adjust write-region so file name is at the beginning again

* lisp/epa-file.el (epa-file-write-region):
* lisp/gnus/mm-util.el (mm-append-to-file):
* lisp/jka-compr.el (jka-compr-write-region):
* lisp/net/ange-ftp.el (ange-ftp-write-region):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-write-region):
* lisp/net/tramp-sh.el (tramp-sh-handle-write-region):
* src/fileio.c (write_region): Put file name at the beginning and move
number of characters to the end of the message.
parent 75824977
...@@ -290,11 +290,10 @@ If no one is selected, symmetric encryption will be performed. " ...@@ -290,11 +290,10 @@ If no one is selected, symmetric encryption will be performed. "
(if (or (eq visit t) (if (or (eq visit t)
(eq visit nil) (eq visit nil)
(stringp visit)) (stringp visit))
(message "Wrote %d characters to `%s'" (message "Wrote `%s' (%d characters)" buffer-file-name
(cond ((null start) (buffer-size)) (cond ((null start) (buffer-size))
((stringp start) (length start)) ((stringp start) (length start))
(t (- end start))) (t (- end start)))))))
buffer-file-name))))
(put 'write-region 'epa-file 'epa-file-write-region) (put 'write-region 'epa-file 'epa-file-write-region)
(defun epa-file-select-keys () (defun epa-file-select-keys ()
......
...@@ -736,7 +736,7 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." ...@@ -736,7 +736,7 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'."
inhibit-file-name-handlers) inhibit-file-name-handlers)
inhibit-file-name-handlers))) inhibit-file-name-handlers)))
(write-region start end filename t 'no-message) (write-region start end filename t 'no-message)
(message "Appended %d characters to `%s'" (- end start) filename))) (message "Appended to `%s' (%d characters)" filename (- end start))))
(defun mm-write-region (start end filename &optional append visit lockname (defun mm-write-region (start end filename &optional append visit lockname
coding-system inhibit) coding-system inhibit)
......
...@@ -357,11 +357,10 @@ There should be no more than seven characters after the final `/'." ...@@ -357,11 +357,10 @@ There should be no more than seven characters after the final `/'."
(and (or (eq visit t) (and (or (eq visit t)
(eq visit nil) (eq visit nil)
(stringp visit)) (stringp visit))
(message "Wrote %d characters to `%s'" (message "Wrote `%s' (%d characters)" visit-file
(cond ((null start) (buffer-size)) (cond ((null start) (buffer-size))
((stringp start) (length start)) ((stringp start) (length start))
(t (- end start))) (t (- end start)))))
visit-file))
;; ensure `last-coding-system-used' has an appropriate value ;; ensure `last-coding-system-used' has an appropriate value
(setq last-coding-system-used coding-system-used) (setq last-coding-system-used coding-system-used)
......
...@@ -3284,11 +3284,10 @@ system TYPE.") ...@@ -3284,11 +3284,10 @@ system TYPE.")
(set-buffer-modified-p nil))) (set-buffer-modified-p nil)))
;; ensure `last-coding-system-used' has an appropriate value ;; ensure `last-coding-system-used' has an appropriate value
(setq last-coding-system-used coding-system-used) (setq last-coding-system-used coding-system-used)
(ange-ftp-message "Wrote %d characters to `%s'" (ange-ftp-message "Wrote `%s' (%d characters)" abbr
(cond ((null start) (buffer-size)) (cond ((null start) (buffer-size))
((stringp start) (length start)) ((stringp start) (length start))
(t (- end start))) (t (- end start))))
abbr)
(ange-ftp-add-file-entry filename)) (ange-ftp-add-file-entry filename))
(ange-ftp-real-write-region start end filename append visit)))) (ange-ftp-real-write-region start end filename append visit))))
......
...@@ -1223,11 +1223,10 @@ file-notify events." ...@@ -1223,11 +1223,10 @@ file-notify events."
;; The end. ;; The end.
(when (or (eq visit t) (null visit) (stringp visit)) (when (or (eq visit t) (null visit) (stringp visit))
(tramp-message v 0 "Wrote %d characters to `%s'" (tramp-message v 0 "Wrote `%s' (%d characters)" filename
(cond ((null start) (buffer-size)) (cond ((null start) (buffer-size))
((stringp start) (length start)) ((stringp start) (length start))
(t (- end start))) (t (- end start)))))
filename))
(run-hooks 'tramp-handle-write-region-hook))) (run-hooks 'tramp-handle-write-region-hook)))
......
...@@ -3411,11 +3411,10 @@ the result will be a local, non-Tramp, file name." ...@@ -3411,11 +3411,10 @@ the result will be a local, non-Tramp, file name."
(when need-chown (when need-chown
(tramp-set-file-uid-gid filename uid gid)) (tramp-set-file-uid-gid filename uid gid))
(when (or (eq visit t) (null visit) (stringp visit)) (when (or (eq visit t) (null visit) (stringp visit))
(tramp-message v 0 "Wrote %d characters to `%s'" (tramp-message v 0 "Wrote `%s' (%d characters)" filename
(cond ((null start) (buffer-size)) (cond ((null start) (buffer-size))
((stringp start) (length start)) ((stringp start) (length start))
(t (- end start))) (t (- end start)))))
filename))
(run-hooks 'tramp-handle-write-region-hook))))) (run-hooks 'tramp-handle-write-region-hook)))))
(defvar tramp-vc-registered-file-names nil (defvar tramp-vc-registered-file-names nil
......
...@@ -5152,14 +5152,13 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename, ...@@ -5152,14 +5152,13 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
if (!auto_saving && !noninteractive) if (!auto_saving && !noninteractive)
{ {
AUTO_STRING (format, NUMBERP (append) AUTO_STRING (format, NUMBERP (append)
? "Updated %d characters of `%s'" ? "Updated `%s' (%d characters)"
: ! NILP (append) : ! NILP (append)
? "Added %d characters to `%s'" ? "Added to `%s' (%d characters)"
: "Wrote %d characters to `%s'"); : "Wrote `%s' (%d characters)");
CALLN (Fmessage, format, CALLN (Fmessage, format, visit_file,
(STRINGP (start) ? Flength (start) (STRINGP (start) ? Flength (start)
: make_number (XINT (end) - XINT (start))), : make_number (XINT (end) - XINT (start))));
visit_file);
} }
return Qnil; return Qnil;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment