emacs-devel
[Top][All Lists]
Advanced

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

Re: PR: dired-do-create-files now checks for trailing slashes in the tar


From: Tassilo Horn
Subject: Re: PR: dired-do-create-files now checks for trailing slashes in the target
Date: Thu, 30 Sep 2021 16:10:02 +0200
User-agent: mu4e 1.7.0; emacs 28.0.50

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Tassilo Horn <tsdh@gnu.org> writes:
>
>> 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.
>
> That does seem quite intuitive and attractive (and is somewhat
> analogous to what Emacs does with `C-x C-w' today).

Right.

> OK, you've convinced me.  Adding a user option like
> `dired-create-destination-dirs' (as Eli said) is probably the best,
> though.

`dired-create-destination-dirs' already exists.  But in Rudi's most
recent patch version, he added a new one.

--8<---------------cut here---------------start------------->8---
+(defcustom dired-create-destination-dirs-trailing-separator-special nil
+  "If t, when selecting a single destination in Dired, paths that end in a 
path separator will be treated as a non-existent directory, and acted on 
according to `dired-create-destination-dirs'.
+
+This option is only relevant if `dired-create-destination-dirs' is not `nil', 
and you are moving/copying a single directory.
+
+For example, when renaming a directory named `old_name' to `new_name/' (note 
the trailing path separator), `new_name' might be created depending on 
`dired-create-destination-dirs' and `old_name' will be moved into it if it is 
created; Otherwise `old_name' will be directly renamed to `new_name'."
+  :type '(choice (const :tag "Do not treat paths with a trailing path 
separator specially" nil)
+                 (const :tag "Treat paths with a trailing path separator 
specially" t))
+  :group 'dired
+  :version "28.1")
--8<---------------cut here---------------end--------------->8---

I still think that this is not really necessary but won't object.

Rudi proposed that the default value should probably be `t' given that
this feels so intuitive and the only gotcha is renaming/moving or
copying a directory source/ to a non-existent target or target/ where
the former has rename/make a copy semantics and the latter has move/copy
*into* the to be created target/ directory.

Bye,
Tassilo



reply via email to

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