From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#6817: (Feature request w/ patch) wdired should create directories needed for destination files Date: Fri, 26 Feb 2016 17:14:51 +1030 Message-ID: <87mvqot1gc.fsf@gnus.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456469181 30025 80.91.229.3 (26 Feb 2016 06:46:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Feb 2016 06:46:21 +0000 (UTC) Cc: 6817@debbugs.gnu.org To: Phil Sung Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 26 07:46:09 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aZCAD-0000Qv-Ig for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 07:46:09 +0100 Original-Received: from localhost ([::1]:47709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZCAD-00080Q-30 for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 01:46:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZCA9-0007yb-8v for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 01:46:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZCA6-0001eW-3L for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 01:46:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZCA6-0001eM-0A for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 01:46:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aZCA5-00030v-SK for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 01:46:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Feb 2016 06:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6817 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 6817-submit@debbugs.gnu.org id=B6817.14564691219489 (code B ref 6817); Fri, 26 Feb 2016 06:46:01 +0000 Original-Received: (at 6817) by debbugs.gnu.org; 26 Feb 2016 06:45:21 +0000 Original-Received: from localhost ([127.0.0.1]:46705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZC9R-0002Sj-CW for submit@debbugs.gnu.org; Fri, 26 Feb 2016 01:45:21 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:35271) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZC9P-0002Qn-M0 for 6817@debbugs.gnu.org; Fri, 26 Feb 2016 01:45:20 -0500 Original-Received: from [175.103.25.178] (helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aZC91-0005gP-E1; Fri, 26 Feb 2016 07:44:56 +0100 In-Reply-To: (Phil Sung's message of "Fri, 6 Aug 2010 14:26:04 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aZC91-0005gP-E1 MailScanner-NULL-Check: 1457073897.00996@LXlY1Rv0eCe5h0k3HcDdTQ X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113851 Archived-At: Phil Sung 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