[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6817: (Feature request w/ patch) wdired should create directories ne

From: Lars Ingebrigtsen
Subject: bug#6817: (Feature request w/ patch) wdired should create directories needed for destination files
Date: Fri, 26 Feb 2016 17:14:51 +1030
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Phil Sung <address@hidden> 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.)


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]