From: Bastien Guerry Date: Fri, 11 Feb 2011 17:35:37 +0000 (+0100) Subject: Save unmodified buffers when buffer-file-name doesn't exist. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~927 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75d1d833f5273724839fdf46543d6b0920695700;p=emacs.git 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. --- 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.