From 75d1d833f5273724839fdf46543d6b0920695700 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 11 Feb 2011 18:35:37 +0100 Subject: [PATCH] Save unmodified buffers when buffer-file-name doesn't exist. * files.el (basic-save-buffer): save unmodified buffers when the file pointed by buffer-file-name doesn't exist. --- lisp/ChangeLog | 5 +++++ lisp/files.el | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b3735e37289..043c8bebea6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-02-11 Bastien Guerry + + * files.el (basic-save-buffer): save unmodified buffers when + the file pointed by buffer-file-name doesn't exist. + 2011-02-11 Deniz Dogan * net/rcirc.el (defun-rcirc-join): Accept multiple channels. diff --git a/lisp/files.el b/lisp/files.el index 8b42eaaddb8..43b31cb0a7a 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4309,7 +4309,11 @@ Before and after saving the buffer, this function runs ;; In an indirect buffer, save its base buffer instead. (if (buffer-base-buffer) (set-buffer (buffer-base-buffer))) - (if (buffer-modified-p) + (if (or (buffer-modified-p) + ;; handle the case when no modification has been made but + ;; the file disappeared since visited + (and buffer-file-name + (not (file-exists-p buffer-file-name)))) (let ((recent-save (recent-auto-save-p)) setmodes) ;; If buffer has no file name, ask user for one. -- 2.39.5