aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-03-05 04:00:53 +0000
committerRichard M. Stallman1998-03-05 04:00:53 +0000
commit19618231c31ba49a1a64214d49ed672c679e485a (patch)
tree5b492e192cce7e90346cd5c2770a60fa4ee44d4a
parentbd6a841426024265cd0860bb954b80eb55592846 (diff)
downloademacs-19618231c31ba49a1a64214d49ed672c679e485a.tar.gz
emacs-19618231c31ba49a1a64214d49ed672c679e485a.zip
(basic-save-buffer): Use save-current-buffer not save-excursion.
-rw-r--r--lisp/files.el27
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 606c49e6a14..3a9ab31f308 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2160,7 +2160,7 @@ the last real save, but optional arg FORCE non-nil means delete anyway."
2160 "Save the current buffer in its visited file, if it has been modified. 2160 "Save the current buffer in its visited file, if it has been modified.
2161After saving the buffer, run `after-save-hook'." 2161After saving the buffer, run `after-save-hook'."
2162 (interactive) 2162 (interactive)
2163 (save-excursion 2163 (save-current-buffer
2164 ;; In an indirect buffer, save its base buffer instead. 2164 ;; In an indirect buffer, save its base buffer instead.
2165 (if (buffer-base-buffer) 2165 (if (buffer-base-buffer)
2166 (set-buffer (buffer-base-buffer))) 2166 (set-buffer (buffer-base-buffer)))
@@ -2198,18 +2198,19 @@ After saving the buffer, run `after-save-hook'."
2198 (error "Save not confirmed")) 2198 (error "Save not confirmed"))
2199 (save-restriction 2199 (save-restriction
2200 (widen) 2200 (widen)
2201 (and (> (point-max) 1) 2201 (save-excursion
2202 (/= (char-after (1- (point-max))) ?\n) 2202 (and (> (point-max) 1)
2203 (not (and (eq selective-display t) 2203 (/= (char-after (1- (point-max))) ?\n)
2204 (= (char-after (1- (point-max))) ?\r))) 2204 (not (and (eq selective-display t)
2205 (or (eq require-final-newline t) 2205 (= (char-after (1- (point-max))) ?\r)))
2206 (and require-final-newline 2206 (or (eq require-final-newline t)
2207 (y-or-n-p 2207 (and require-final-newline
2208 (format "Buffer %s does not end in newline. Add one? " 2208 (y-or-n-p
2209 (buffer-name))))) 2209 (format "Buffer %s does not end in newline. Add one? "
2210 (save-excursion 2210 (buffer-name)))))
2211 (goto-char (point-max)) 2211 (save-excursion
2212 (insert ?\n))) 2212 (goto-char (point-max))
2213 (insert ?\n))))
2213 (or (run-hook-with-args-until-success 'write-contents-hooks) 2214 (or (run-hook-with-args-until-success 'write-contents-hooks)
2214 (run-hook-with-args-until-success 'local-write-file-hooks) 2215 (run-hook-with-args-until-success 'local-write-file-hooks)
2215 (run-hook-with-args-until-success 'write-file-hooks) 2216 (run-hook-with-args-until-success 'write-file-hooks)