From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ingo Lohmar Newsgroups: gmane.emacs.bugs Subject: bug#6817: (Feature request w/ patch) wdired should create directories needed for destination files Date: Fri, 26 Feb 2016 18:49:07 +0100 Message-ID: <87ziun8ir0.fsf@acer.localhost.com> References: <87mvqot1gc.fsf@gnus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1456509024 23912 80.91.229.3 (26 Feb 2016 17:50:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Feb 2016 17:50:24 +0000 (UTC) Cc: 6817@debbugs.gnu.org To: Lars Ingebrigtsen , Phil Sung Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 26 18:50:13 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 1aZMWr-0004I4-7K for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 18:50:13 +0100 Original-Received: from localhost ([::1]:51430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZMWq-0007eQ-RF for geb-bug-gnu-emacs@m.gmane.org; Fri, 26 Feb 2016 12:50:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZMWj-0007e9-M1 for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 12:50:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZMWg-0007mw-D5 for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 12:50:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZMWg-0007ml-9a for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 12:50:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aZMWf-0001aR-VJ for bug-gnu-emacs@gnu.org; Fri, 26 Feb 2016 12:50:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ingo Lohmar Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Feb 2016 17:50: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.14565089586044 (code B ref 6817); Fri, 26 Feb 2016 17:50:01 +0000 Original-Received: (at 6817) by debbugs.gnu.org; 26 Feb 2016 17:49:18 +0000 Original-Received: from localhost ([127.0.0.1]:47854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZMVy-0001ZQ-2l for submit@debbugs.gnu.org; Fri, 26 Feb 2016 12:49:18 -0500 Original-Received: from mail-wm0-f42.google.com ([74.125.82.42]:33157) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aZMVv-0001ZB-V4 for 6817@debbugs.gnu.org; Fri, 26 Feb 2016 12:49:16 -0500 Original-Received: by mail-wm0-f42.google.com with SMTP id g62so82010130wme.0 for <6817@debbugs.gnu.org>; Fri, 26 Feb 2016 09:49:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version; bh=NydKGopeRh2cLLRDYJIe2ChfLZvs0swfa1YAhOK3R5c=; b=wGqsu/fRWregYy8mB2EH3253dpzDBFtALEiGi7vtmbfx83ICsL+Wmv3KXeDh8cBowQ d8DWEE2Nj6kmWL0IzhWfRJ4uOUk7vN2eD7/ycXL6NaaR0bpuErN7DbwQOJZ0yVClAZeB dZcLGsJeahMLIU2WfgBKNwOWQvPBX2X3AG1lEMGkjlloIOUXK5D1r/Zmw/YGkdIfhS2W kG2WnJW7dfThS7JnxIJNU3WDS5DCfQX7DpByHRx5031P+wQt1q36QmOJIRztJ0134xN0 g2DOO6tm1KoNLzKlCjV1yPpW5O6Irl1rNCoMYxUfiTXs4r1SCzlC0UDbCZg3S8VTZmeh YVDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=NydKGopeRh2cLLRDYJIe2ChfLZvs0swfa1YAhOK3R5c=; b=lp4QOJrY6n1r+NgT1zJIZcRYwb5MA2wEEjjFLUXUE5OB0GKYEiSvXxOBNI4ELIl/SX W/IsngsYtWPT6XrYqL3jw7f6mAm13Jv1BTbLKBRL6JXc9ou24+OpOtptRaD7J0ziZ5uK 0IN/cyrkU2VXX2gxm1+gWa1J1IcsEr9tlq6KCXWfaggaRUNdzl9S/fpszju06+Qp/3hF ejJ8V+Er7jAnGYfqKRxbzVpDM1bC6DCxhGnbFKHUWCC9rWVgIlRDCPrZ5gu6JWaeIbAo t/QsNCALC31oFJkQs0Y3aFdXfvSLj4lmD7mIr04hUgDZBMhH3FlrOrhIXg0QN3rSeytY ZbxA== X-Gm-Message-State: AD7BkJJ7DwLQi8AhMIi2uyryVaNsuvh4DJwy3j9jZxSFtNVM34t2Li1riM/VwnES6tp71Q== X-Received: by 10.28.175.139 with SMTP id y133mr4165195wme.45.1456508950326; Fri, 26 Feb 2016 09:49:10 -0800 (PST) Original-Received: from localhost (xdsl-87-78-1-238.netcologne.de. [87.78.1.238]) by smtp.gmail.com with ESMTPSA id m63sm3831856wmc.3.2016.02.26.09.49.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Feb 2016 09:49:09 -0800 (PST) In-Reply-To: <87mvqot1gc.fsf@gnus.org> User-Agent: Notmuch/0.20.2+113~g6332e6e (http://notmuchmail.org) Emacs/25.0.90.1 (x86_64-pc-linux-gnu) 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:113901 Archived-At: On Fri, Feb 26 2016 17:14 (+1030), Lars Ingebrigtsen wrote: > 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? 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..