From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: PR: dired-do-create-files now checks for trailing slashes in the target Date: Thu, 30 Sep 2021 10:32:27 +0200 Message-ID: <87sfxmqwdr.fsf@gnu.org> References: <831r58k0cx.fsf@gnu.org> <87tui4qyni.fsf@gnu.org> <83tui4iift.fsf@gnu.org> <874ka43rp1.fsf@gnu.org> <83ee97il43.fsf@gnu.org> <87zgrv33mf.fsf@gnu.org> <838rzfijnj.fsf@gnu.org> <87r1d73312.fsf@gnu.org> <837deziiwz.fsf@gnu.org> <87ee97bgxt.fsf@gnus.org> <87fstn2ydc.fsf@gnu.org> <87bl4a7g2m.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7873"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.7.0; emacs 28.0.50 Cc: Eli Zaretskii , emacs-devel@gnu.org, rudiwillalwaysloveyou@gmail.com, Stefan Kangas To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 30 10:53:20 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVrod-0001mW-TK for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Sep 2021 10:53:19 +0200 Original-Received: from localhost ([::1]:48704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVroc-0007wb-Qd for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Sep 2021 04:53:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVrmt-0005fz-Ks for emacs-devel@gnu.org; Thu, 30 Sep 2021 04:51:31 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36408) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVrmt-0007oN-8h; Thu, 30 Sep 2021 04:51:31 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:53151) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVrms-00015m-WF; Thu, 30 Sep 2021 04:51:31 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 8450427C0054; Thu, 30 Sep 2021 04:51:30 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 30 Sep 2021 04:51:30 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekgedgtdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvufffjgfkgggtgfesthhqredttderjeenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe fhffeugfffjeefvdektdevudeggeffueejjefglefgveekfedvgefghffgueelleenucff ohhmrghinhepthigthdrshhonecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihht hidqkeeijeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrsh htmhgrihhlrdhfmh X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Sep 2021 04:51:29 -0400 (EDT) In-reply-to: <87bl4a7g2m.fsf@gnus.org> X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:275867 Archived-At: Lars Ingebrigtsen writes: Hi Lars, >> Lars, note that we are not talking about a specific command like >> `dired-do-rename'. The change is to `dired-do-create-files' which is a >> workhorse for many dired commands that need some target directory or >> file, e.g., renaming/moving, copying, symlinking, etc. > > Right. Then it's more invasive than I thought... > > Re-skimming this thread, the suggestion is that if the destination > directory ends with a slash, then that directory is created, and the > contents of the source is copied (etc) over to it? Right. And the creation of a target directory is nothing new but already exists if `dired-create-destination-dirs' is non-nil. For example, when you now (without the patch) copy file.txt to bar/foo where bar/ doesn't exist, you'll be queried if dired should create it if the variable is 'ask. If it is 'always, dired just creates it. Finally bar/foo is a normal file, i.e., a copy of file.txt. With Rudi's patch, it's exactly the same when the destination is foo/bar. But if you specify foo/bar/ as destination, dired will create foo/bar/ (maybe after asking as controlled by `dired-create-destination-dirs') and you get foo/bar/file.txt. So basically the trailing / is an indicator to tell dired that the target must be a directory, and then the `dired-create-destination-dirs' semantics can apply. Without the /, dired cannot know. Therefore, the feature seems very natural to me. I'm fine with guarding it with a defcustom if you all feel that many users would type a trailing / out of habit. But since the change only triggers if the directory does not exist yet, the only scenario where it can bite you is when renaming or copying a directory to a new one and you specify the new one with trailing / (which completion will never do because there's no completion for non-existing directories). > Isn't that just about the opposite of the syntax in rsync? Sorry, I don't have a lot of rsync experience. And to me, it's not really important that dired conforms to rsync conventions. Instead it should conform to its own documentation we already have right now. --8<---------------cut here---------------start------------->8--- dired-create-destination-dirs is a variable defined in =E2=80=98dired-aux.e= l=E2=80=99. Its value is =E2=80=98ask=E2=80=99 Original value was nil Whether Dired should create destination dirs when copying/removing files. If nil, don=E2=80=99t create them. If =E2=80=98always=E2=80=99, create them without asking. If =E2=80=98ask=E2=80=99, ask for user confirmation. --8<---------------cut here---------------end--------------->8--- So when I copy/rename something to the non-existent bar/foo/baz/ where it's absolutely clear that it's a directory, why on earth should dired not create it? I would argue that with Rudi's patch the behavior conforms more to the current docs than the non-patched dired. Bye, Tassilo