diff options
| -rw-r--r-- | lisp/files.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/files.el b/lisp/files.el index 703050582c4..fb989b917aa 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2222,6 +2222,9 @@ Calling `write-region' for any purpose other than saving the buffer | |||
| 2222 | will still use `buffer-file-coding-system'; this variable has no effect | 2222 | will still use `buffer-file-coding-system'; this variable has no effect |
| 2223 | in such cases.") | 2223 | in such cases.") |
| 2224 | 2224 | ||
| 2225 | (make-variable-buffer-local 'save-buffer-coding-system) | ||
| 2226 | (put 'save-buffer-coding-system 'permanent-local t) | ||
| 2227 | |||
| 2225 | (defun basic-save-buffer () | 2228 | (defun basic-save-buffer () |
| 2226 | "Save the current buffer in its visited file, if it has been modified. | 2229 | "Save the current buffer in its visited file, if it has been modified. |
| 2227 | The hooks `write-contents-hooks', `local-write-file-hooks' and | 2230 | The hooks `write-contents-hooks', `local-write-file-hooks' and |
| @@ -2311,10 +2314,13 @@ After saving the buffer, this function runs `after-save-hook'." | |||
| 2311 | ;; but inhibited if one of write-file-hooks returns non-nil. | 2314 | ;; but inhibited if one of write-file-hooks returns non-nil. |
| 2312 | ;; It returns a value to store in setmodes. | 2315 | ;; It returns a value to store in setmodes. |
| 2313 | (defun basic-save-buffer-1 () | 2316 | (defun basic-save-buffer-1 () |
| 2314 | (let ((buffer-file-coding-system | 2317 | (if save-buffer-coding-system |
| 2315 | (or save-buffer-coding-system | 2318 | (let ((coding-system-for-write save-buffer-coding-system)) |
| 2316 | buffer-file-coding-system)) | 2319 | (basic-save-buffer-2)) |
| 2317 | tempsetmodes setmodes) | 2320 | (basic-save-buffer-2))) |
| 2321 | |||
| 2322 | (defun basic-save-buffer-2 () | ||
| 2323 | (let (tempsetmodes setmodes) | ||
| 2318 | (if (not (file-writable-p buffer-file-name)) | 2324 | (if (not (file-writable-p buffer-file-name)) |
| 2319 | (let ((dir (file-name-directory buffer-file-name))) | 2325 | (let ((dir (file-name-directory buffer-file-name))) |
| 2320 | (if (not (file-directory-p dir)) | 2326 | (if (not (file-directory-p dir)) |