GNU bug report logs - #6817
(Feature request w/ patch) wdired should create directories needed for destination files

Previous Next

Package: emacs;

Reported by: Phil Sung <philbert <at> gmail.com>

Date: Fri, 6 Aug 2010 21:28:03 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ingo Lohmar <i.lohmar <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Phil Sung <philbert <at> gmail.com>
Cc: 6817 <at> 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
On Fri, Feb 26 2016 17:14 (+1030), Lars Ingebrigtsen wrote:

> Phil Sung <philbert <at> 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..




This bug report was last modified 8 years and 174 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.