From: Bastien <bzg@altern.org>
To: Glenn Morris <rgm@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: /srv/bzr/emacs/trunk r111746: * files.el (basic-save-buffer): Offer to create a non-existing directory.
Date: Wed, 13 Feb 2013 12:05:31 +0100 [thread overview]
Message-ID: <878v6swk1w.fsf@bzg.ath.cx> (raw)
In-Reply-To: <E1U5BzI-0002eB-PS@vcs.savannah.gnu.org> (Glenn Morris's message of "Tue, 12 Feb 2013 00:36:09 -0800")
[-- Attachment #1: Type: text/plain, Size: 244 bytes --]
Hi Glenn,
Glenn Morris <rgm@gnu.org> writes:
> * files.el (basic-save-buffer): Offer to create a non-existing
> directory.
The attached patch implements the same change for `find-file'.
Let me know if it's okay to apply this.
Thanks!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: files.el.patch --]
[-- Type: text/x-patch, Size: 1058 bytes --]
=== 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))))
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
--
Bastien
next parent reply other threads:[~2013-02-13 11:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1U5BzI-0002eB-PS@vcs.savannah.gnu.org>
2013-02-13 11:05 ` Bastien [this message]
2013-02-13 15:08 ` /srv/bzr/emacs/trunk r111746: * files.el (basic-save-buffer): Offer to create a non-existing directory Stefan Monnier
2013-02-13 16:54 ` Bastien
2013-02-13 19:27 ` Stefan Monnier
2013-02-13 23:58 ` Xue Fuqiao
2013-02-14 6:23 ` Bastien
2013-02-14 6:23 ` Thierry Volpiatto
2013-02-14 13:59 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878v6swk1w.fsf@bzg.ath.cx \
--to=bzg@altern.org \
--cc=emacs-devel@gnu.org \
--cc=rgm@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).