aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-07-24 10:43:29 +0000
committerRichard M. Stallman1998-07-24 10:43:29 +0000
commitd5fe94cca85dc89ae35ebe11e3e6b669ea8ea325 (patch)
tree78c735d63336d5b7f47e08ddce5ace5e165ae45e
parent271e0f2c6a5b2824c8f635cdfc1ae5a9ea5149b6 (diff)
downloademacs-d5fe94cca85dc89ae35ebe11e3e6b669ea8ea325.tar.gz
emacs-d5fe94cca85dc89ae35ebe11e3e6b669ea8ea325.zip
(basic-save-buffer-2): New function.
(basic-save-buffer-1): Use basic-save-buffer-2, after perhaps binding coding-system-for-write. (save-buffer-coding-system): Make it a permanent local.
-rw-r--r--lisp/files.el14
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
2222will still use `buffer-file-coding-system'; this variable has no effect 2222will still use `buffer-file-coding-system'; this variable has no effect
2223in such cases.") 2223in 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.
2227The hooks `write-contents-hooks', `local-write-file-hooks' and 2230The 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))