diff options
| author | Glenn Morris | 2014-08-10 17:38:19 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-08-10 17:38:19 -0700 |
| commit | f314e84fce8b394da20aa1d69121c74fb34f9a1e (patch) | |
| tree | 214ada74bd8ae7e7450d5269b03cdf51ed87d11d /lisp | |
| parent | db2f09ab1be010a06a88269d39fb14c191452f1c (diff) | |
| download | emacs-f314e84fce8b394da20aa1d69121c74fb34f9a1e.tar.gz emacs-f314e84fce8b394da20aa1d69121c74fb34f9a1e.zip | |
Revert 2013-01-31 change that decides coding system before backing up
It causes a more serious problem than the one it solves.
This closes bug#18141, and reopens bug#13522.
* lisp/files.el (basic-save-buffer-2): Revert 2013-01-31 change.
* src/fileio.c: Revert 2013-01-31 change.
(choose_write_coding_system): No longer callable from Lisp.
Move last piece back here from Fwrite_region.
(Fwrite_region, syms_of_fileio): Update for above changes.
* test/automated/data/files-bug18141.el.gz: New file.
* test/automated/files.el (files-test-bug-18141-file):
New variable and test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/files.el | 13 |
2 files changed, 9 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cec6e709c2b..ba8dac2c4e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2014-08-11 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * files.el (basic-save-buffer-2): Revert 2013-01-31 change, which | ||
| 4 | chose coding system for writing before backing up, since it causes | ||
| 5 | a more serious problem than the one it solves. (Closes Bug#18141, | ||
| 6 | reopens Bug#13522.) | ||
| 7 | |||
| 1 | 2014-08-10 Martin Rudalics <rudalics@gmx.at> | 8 | 2014-08-10 Martin Rudalics <rudalics@gmx.at> |
| 2 | 9 | ||
| 3 | * window.el (window-total-size): Make doc-string more | 10 | * window.el (window-total-size): Make doc-string more |
diff --git a/lisp/files.el b/lisp/files.el index 6c3b8f4fa4d..5ed5f8a6e1e 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -4756,7 +4756,7 @@ Before and after saving the buffer, this function runs | |||
| 4756 | ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like | 4756 | ;; This returns a value (MODES EXTENDED-ATTRIBUTES BACKUPNAME), like |
| 4757 | ;; backup-buffer. | 4757 | ;; backup-buffer. |
| 4758 | (defun basic-save-buffer-2 () | 4758 | (defun basic-save-buffer-2 () |
| 4759 | (let (tempsetmodes setmodes writecoding) | 4759 | (let (tempsetmodes setmodes) |
| 4760 | (if (not (file-writable-p buffer-file-name)) | 4760 | (if (not (file-writable-p buffer-file-name)) |
| 4761 | (let ((dir (file-name-directory buffer-file-name))) | 4761 | (let ((dir (file-name-directory buffer-file-name))) |
| 4762 | (if (not (file-directory-p dir)) | 4762 | (if (not (file-directory-p dir)) |
| @@ -4772,14 +4772,6 @@ Before and after saving the buffer, this function runs | |||
| 4772 | buffer-file-name))) | 4772 | buffer-file-name))) |
| 4773 | (setq tempsetmodes t) | 4773 | (setq tempsetmodes t) |
| 4774 | (error "Attempt to save to a file which you aren't allowed to write")))))) | 4774 | (error "Attempt to save to a file which you aren't allowed to write")))))) |
| 4775 | ;; This may involve prompting, so do it now before backing up the file. | ||
| 4776 | ;; Otherwise there can be a delay while the user answers the | ||
| 4777 | ;; prompt during which the original file has been renamed. (Bug#13522) | ||
| 4778 | (setq writecoding | ||
| 4779 | ;; Args here should match write-region call below around | ||
| 4780 | ;; which we use writecoding. | ||
| 4781 | (choose-write-coding-system nil nil buffer-file-name nil t | ||
| 4782 | buffer-file-truename)) | ||
| 4783 | (or buffer-backed-up | 4775 | (or buffer-backed-up |
| 4784 | (setq setmodes (backup-buffer))) | 4776 | (setq setmodes (backup-buffer))) |
| 4785 | (let* ((dir (file-name-directory buffer-file-name)) | 4777 | (let* ((dir (file-name-directory buffer-file-name)) |
| @@ -4861,11 +4853,10 @@ Before and after saving the buffer, this function runs | |||
| 4861 | (logior (car setmodes) 128)))))) | 4853 | (logior (car setmodes) 128)))))) |
| 4862 | (let (success) | 4854 | (let (success) |
| 4863 | (unwind-protect | 4855 | (unwind-protect |
| 4856 | (progn | ||
| 4864 | ;; Pass in nil&nil rather than point-min&max to indicate | 4857 | ;; Pass in nil&nil rather than point-min&max to indicate |
| 4865 | ;; we're saving the buffer rather than just a region. | 4858 | ;; we're saving the buffer rather than just a region. |
| 4866 | ;; write-region-annotate-functions may make us of it. | 4859 | ;; write-region-annotate-functions may make us of it. |
| 4867 | (let ((coding-system-for-write writecoding) | ||
| 4868 | (coding-system-require-warning nil)) | ||
| 4869 | (write-region nil nil | 4860 | (write-region nil nil |
| 4870 | buffer-file-name nil t buffer-file-truename) | 4861 | buffer-file-name nil t buffer-file-truename) |
| 4871 | (setq success t)) | 4862 | (setq success t)) |