From: Ingo Lohmar <i.lohmar@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>, Phil Sung <philbert@gmail.com>
Cc: 6817@debbugs.gnu.org
Subject: bug#6817: (Feature request w/ patch) wdired should create directories needed for destination files
Date: Fri, 26 Feb 2016 18:49:07 +0100 [thread overview]
Message-ID: <87ziun8ir0.fsf@acer.localhost.com> (raw)
In-Reply-To: <87mvqot1gc.fsf@gnus.org>
On Fri, Feb 26 2016 17:14 (+1030), Lars Ingebrigtsen wrote:
> Phil Sung <philbert@gmail.com> writes:
>
>> It is sometimes useful in wdired to be able to move files into
>> directories that don't yet exist, e.g. when one is reorganizing files
>> and directories. The attached patch (against git HEAD), based on
>> previous work by Joakim Verona (source:
>> http://www.emacswiki.org/emacs/WDired), makes wdired create parent
>> directories needed as necessary for the destination files, conditional
>> on the variable `wdired-create-parent-directories'.
>>
>> What do others think of this feature?
>
> [...]
>
>> +(defcustom wdired-create-parent-directories nil
>> + "If non-nil, create parent directories of destination files.
>> +
>> +If non-nil, when you rename a file to a destination path within a
>> +nonexistent directory, wdired will create any parent directories
>> +necessary. When nil, attempts to rename a file into a nonexistent
>> +directory will fail."
>> + :type 'boolean
>> + :group 'wdired)
>
> [...]
>
>> +(defun wdired-create-parentdirs (file-new)
>> + "Create parent directories for FILE-NEW if they don't exist."
>> + (and (not (file-exists-p (file-name-directory file-new)))
>> + (message "Creating directory for file %s" file-new)
>> + (make-directory (file-name-directory file-new) t)))
>
> I think this makes sense, but I've used wdired very little, so I don't
> quite have a handle on whether this is a use case that people would
> like. (And if so, the default should probably be t, here.)
>
> Opinions?
I've been running with this patch for years (though not extensively
using it), and it has never failed me. I think this is a very useful
addition, and would also like the "t"-default, though that is not
essential..
next prev parent reply other threads:[~2016-02-26 17:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 21:26 bug#6817: (Feature request w/ patch) wdired should create directories needed for destination files Phil Sung
2016-02-26 6:44 ` Lars Ingebrigtsen
2016-02-26 17:49 ` Ingo Lohmar [this message]
2016-02-27 0:51 ` John Wiegley
2016-02-28 4:30 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ziun8ir0.fsf@acer.localhost.com \
--to=i.lohmar@gmail.com \
--cc=6817@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=philbert@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.