summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorKarl Fogel <kfogel@red-bean.com>2009-09-05 15:16:49 +0000
committerKarl Fogel <kfogel@red-bean.com>2009-09-05 15:16:49 +0000
commitef7ef2a01693469788f72fdaa554b88f1b961e0f (patch)
tree9677e0a4703913860f617bf8190cc98759c23aea /lisp/files.el
parent21ee034d123f4e6918cd4b50a7df8f8d8551c661 (diff)
downloademacs-ef7ef2a01693469788f72fdaa554b88f1b961e0f.tar.gz
* lisp/files.el (find-alternate-file): If the old buffer is modified
and visiting a file, behave similarly to `kill-buffer' when killing it, thus reverting to the pre-1.878 behavior; see http://lists.gnu.org/archive/html/emacs-devel/2009-09/msg00101.html for discussion. Also, consult `buffer-file-name' as a variable not as a function, for consistency with the rest of the code.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 9f22a60dc00..773740214b7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1481,12 +1481,12 @@ killed."
t)))
(unless (run-hook-with-args-until-failure 'kill-buffer-query-functions)
(error "Aborted"))
- (when (and (buffer-modified-p) (buffer-file-name))
- (if (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
- (buffer-name)))
- (unless (yes-or-no-p "Kill and replace the buffer without saving it? ")
- (error "Aborted"))
- (save-buffer)))
+ (when (and (buffer-modified-p) buffer-file-name)
+ (if (yes-or-no-p (format "Buffer %s is modified; save it first? "
+ (buffer-name)))
+ (save-buffer)
+ (unless (yes-or-no-p "Kill and replace the buffer without saving it? ")
+ (error "Aborted"))))
(let ((obuf (current-buffer))
(ofile buffer-file-name)
(onum buffer-file-number)