# HG changeset patch # User Richard M. Stallman # Date 889070453 0 # Node ID 39d081df364398fca5d556f4b20f05bb1bf482d7 # Parent f88e08d192a8d936db96434c2b5112d9a19b7bb7 (basic-save-buffer): Use save-current-buffer not save-excursion. diff -r f88e08d192a8 -r 39d081df3643 lisp/files.el --- a/lisp/files.el Thu Mar 05 02:28:44 1998 +0000 +++ b/lisp/files.el Thu Mar 05 04:00:53 1998 +0000 @@ -2160,7 +2160,7 @@ "Save the current buffer in its visited file, if it has been modified. After saving the buffer, run `after-save-hook'." (interactive) - (save-excursion + (save-current-buffer ;; In an indirect buffer, save its base buffer instead. (if (buffer-base-buffer) (set-buffer (buffer-base-buffer))) @@ -2198,18 +2198,19 @@ (error "Save not confirmed")) (save-restriction (widen) - (and (> (point-max) 1) - (/= (char-after (1- (point-max))) ?\n) - (not (and (eq selective-display t) - (= (char-after (1- (point-max))) ?\r))) - (or (eq require-final-newline t) - (and require-final-newline - (y-or-n-p - (format "Buffer %s does not end in newline. Add one? " - (buffer-name))))) - (save-excursion - (goto-char (point-max)) - (insert ?\n))) + (save-excursion + (and (> (point-max) 1) + (/= (char-after (1- (point-max))) ?\n) + (not (and (eq selective-display t) + (= (char-after (1- (point-max))) ?\r))) + (or (eq require-final-newline t) + (and require-final-newline + (y-or-n-p + (format "Buffer %s does not end in newline. Add one? " + (buffer-name))))) + (save-excursion + (goto-char (point-max)) + (insert ?\n)))) (or (run-hook-with-args-until-success 'write-contents-hooks) (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-hooks)