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


Message #8 received at 6817 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Phil Sung <philbert <at> gmail.com>
Cc: 6817 <at> debbugs.gnu.org
Subject: Re: bug#6817: (Feature request w/ patch) wdired should create
 directories needed for destination files
Date: Fri, 26 Feb 2016 17:14:51 +1030
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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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.