all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Eli Zaretskii <eliz@gnu.org>,
	emacs-devel@gnu.org, rudiwillalwaysloveyou@gmail.com,
	Stefan Kangas <stefankangas@gmail.com>
Subject: Re: PR: dired-do-create-files now checks for trailing slashes in the target
Date: Thu, 30 Sep 2021 10:32:27 +0200	[thread overview]
Message-ID: <87sfxmqwdr.fsf@gnu.org> (raw)
In-Reply-To: <87bl4a7g2m.fsf@gnus.org>

Lars Ingebrigtsen <larsi@gnus.org> 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 ‘dired-aux.el’.

Its value is ‘ask’
Original value was nil

Whether Dired should create destination dirs when copying/removing files.
If nil, don’t create them.
If ‘always’, create them without asking.
If ‘ask’, 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



  parent reply	other threads:[~2021-09-30  8:32 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 17:50 PR: dired-do-create-files now checks for trailing slashes in the target Rudi C
2021-09-28 18:17 ` Stefan Kangas
2021-09-28 18:42   ` Rudi C
2021-09-28 19:03     ` Stefan Kangas
2021-09-28 19:38       ` Tassilo Horn
2021-09-28 20:07         ` Stefan Kangas
2021-09-28 20:23       ` Rudi C
2021-09-28 18:42   ` Eli Zaretskii
2021-09-28 19:29     ` Tassilo Horn
2021-09-28 19:55       ` Eli Zaretskii
2021-09-29  4:46         ` Tassilo Horn
2021-09-29 13:09           ` Eli Zaretskii
2021-09-29 13:20             ` Rudi C
2021-09-29 13:34               ` Eli Zaretskii
2021-09-29 13:37               ` Tassilo Horn
2021-09-29 13:42               ` Stefan Kangas
2021-09-29 13:53                 ` Tassilo Horn
2021-09-29 14:31                   ` Rudi C
2021-09-29 13:23             ` Tassilo Horn
2021-09-29 13:41               ` Eli Zaretskii
2021-09-29 13:42                 ` Tassilo Horn
2021-09-29 13:57                   ` Eli Zaretskii
2021-09-29 14:21                     ` Lars Ingebrigtsen
2021-09-29 15:04                       ` Stefan Kangas
2021-09-29 15:17                         ` Tassilo Horn
2021-09-30  6:06                           ` Lars Ingebrigtsen
2021-09-30  7:29                             ` Lars Ingebrigtsen
2021-09-30  8:32                             ` Tassilo Horn [this message]
2021-09-30 13:33                               ` Lars Ingebrigtsen
2021-09-30 14:10                                 ` Tassilo Horn
2021-09-30 16:03                                   ` Eli Zaretskii
2021-09-30 16:48                                     ` Tassilo Horn
2021-09-30 17:47                                       ` Eli Zaretskii
2021-09-30 18:52                                         ` Rudi C
2021-09-30 19:02                                           ` Eli Zaretskii
2021-11-01 15:37                                         ` Rudi C
2021-11-02 14:44                                           ` Lars Ingebrigtsen
2021-11-02 15:08                                             ` Rudi C
2021-11-02 15:15                                               ` Eli Zaretskii
2021-11-09 12:52                                                 ` Rudi C
2021-11-09 13:47                                                   ` Eli Zaretskii
2021-12-05 12:12                                                   ` Tassilo Horn
2021-12-05 13:26                                                     ` Rudi C
2021-12-05 17:00                                                       ` Tassilo Horn
2021-12-06  4:34                                                       ` Richard Stallman
2021-12-05 20:24                                                     ` Lars Ingebrigtsen
2021-12-06  6:01                                                       ` Tassilo Horn
2021-09-30 15:45                               ` [External] : " Drew Adams
2021-09-30 13:54                             ` Stefan Kangas
2021-09-30 13:59                               ` Lars Ingebrigtsen
2021-09-29 15:44                       ` Eli Zaretskii
2021-09-29 17:01                   ` [External] : " Drew Adams
2021-09-29 19:09                     ` Tassilo Horn
2021-09-29 19:35                       ` Drew Adams
2021-09-29 13:57               ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfxmqwdr.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=rudiwillalwaysloveyou@gmail.com \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.