=== modified file 'lisp/files.el' --- lisp/files.el 2013-02-12 08:36:09 +0000 +++ lisp/files.el 2013-02-13 11:04:03 +0000 @@ -2077,6 +2077,7 @@ (if noninteractive nil (let* (not-serious + (dir (file-name-directory buffer-file-name)) (msg (cond ((not warn) nil) @@ -2105,11 +2106,14 @@ "Note: file is write protected") ((file-attributes (directory-file-name default-directory)) "File not found and directory write-protected") - ((file-exists-p (file-name-directory buffer-file-name)) + ((file-exists-p dir) (setq buffer-read-only nil)) (t (setq buffer-read-only nil) - "Use M-x make-directory RET RET to create the directory and its parents")))) + (if (not (y-or-n-p (format "Directory `%s' does not exist; create? " dir))) + "Use M-x make-directory RET RET to create the directory and its parents" + (make-directory dir t) + (format "Directory %s has been created" dir)))))) (when msg (message "%s" msg) (or not-serious (sit-for 1 t))))