GNU bug report logs - #24184
25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names

Previous Next

Package: emacs;

Reported by: Gereon Kaiping <gereon.kaiping <at> gmail.com>

Date: Mon, 8 Aug 2016 15:30:02 UTC

Severity: wishlist

Tags: wontfix

Found in version 25.0.94

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24184 in the body.
You can then email your comments to 24184 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24184; Package emacs. (Mon, 08 Aug 2016 15:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gereon Kaiping <gereon.kaiping <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 08 Aug 2016 15:30:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gereon Kaiping <gereon.kaiping <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.94; dired-copy-filename-as-kill does not quote or properly
 separate file names
Date: Mon, 8 Aug 2016 16:08:40 +0200
Enhancement Request:

> Start emacs
> Find a directory containing more than one file with space in the file
> name, opening that directory in dired
> Mark more than one file, eg. using `m`
> Run 'dired-copy-filename-as-kill for example by pressing `w`
> Notice that there is no difference between the space separating file
> names and the spaces in file names

$ touch "this file" "that file"
$ emacs -Q
C-x C-f RET m m w

gives

that file this file

but should give something like

"that file" "this file"

or

that file
this file

to be much more useful. The former looks cleanest, because then the
content can be yanked as elisp list, but would of course require that
not only filenames are quoted, but that also " be quoted inside file
names.

--
Gereon




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24184; Package emacs. (Sun, 15 Apr 2018 23:14:01 GMT) Full text and rfc822 format available.

Message #8 received at 24184 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gereon Kaiping <gereon.kaiping <at> gmail.com>
Cc: 24184 <at> debbugs.gnu.org
Subject: Re: bug#24184: 25.0.94;
 dired-copy-filename-as-kill does not quote or properly separate file
 names
Date: Mon, 16 Apr 2018 01:13:38 +0200
Gereon Kaiping <gereon.kaiping <at> gmail.com> writes:

> $ touch "this file" "that file"
> $ emacs -Q
> C-x C-f RET m m w
>
> gives
>
> that file this file
>
> but should give something like
>
> "that file" "this file"
>
> or
>
> that file
> this file
>
> to be much more useful. The former looks cleanest, because then the
> content can be yanked as elisp list, but would of course require that
> not only filenames are quoted, but that also " be quoted inside file
> names.

Hm...  I guess that depends on what the purpose of the copy-as-kill is.
In the single file case, we probably don't want to quote "this file"
because then we can't use that to yank it into the file prompt, for
instance.

But in the several-file case, we can't use it for that anyway, and then
quoting these file names is probably better than not.

Hm...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24184; Package emacs. (Mon, 16 Apr 2018 22:18:02 GMT) Full text and rfc822 format available.

Message #11 received at 24184 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Gereon Kaiping <gereon.kaiping <at> gmail.com>, 24184 <at> debbugs.gnu.org
Subject: Re: bug#24184: 25.0.94;
 dired-copy-filename-as-kill does not quote or properly separate file
 names
Date: Mon, 16 Apr 2018 23:40:39 +0300
>> $ touch "this file" "that file"
>> $ emacs -Q
>> C-x C-f RET m m w
>>
>> gives
>>
>> that file this file
>>
>> but should give something like
>>
>> "that file" "this file"
>>
>> or
>>
>> that file
>> this file
>>
>> to be much more useful. The former looks cleanest, because then the
>> content can be yanked as elisp list, but would of course require that
>> not only filenames are quoted, but that also " be quoted inside file
>> names.
>
> Hm...  I guess that depends on what the purpose of the copy-as-kill is.
> In the single file case, we probably don't want to quote "this file"
> because then we can't use that to yank it into the file prompt, for
> instance.
>
> But in the several-file case, we can't use it for that anyway, and then
> quoting these file names is probably better than not.

I think filenames should be quoted only when really necessary.  IOW,
only if (not (equal (shell-quote-argument "this file") "this file"))
but not when (equal (shell-quote-argument "this-file") "this-file").




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24184; Package emacs. (Mon, 16 Apr 2018 22:37:02 GMT) Full text and rfc822 format available.

Message #14 received at 24184 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Juri Linkov <juri <at> linkov.net>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Gereon Kaiping <gereon.kaiping <at> gmail.com>, 24184 <at> debbugs.gnu.org
Subject: RE: bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or
 properly separate file names
Date: Mon, 16 Apr 2018 15:35:56 -0700 (PDT)
> I think filenames should be quoted only when really necessary.  IOW,
> only if (not (equal (shell-quote-argument "this file") "this file"))
> but not when (equal (shell-quote-argument "this-file") "this-file").

Even stronger than that.  There is no reason to suppose
that everyone wants to yank the text only in contexts
where it should be double-quoted.

On the contrary.  People have been usefully yanking it
and using it without quotes for decades.  This is a useful,
longstanding Emacs feature.

If someone wants a different copy or paste or both behavior
then s?he can define a new command and bind a key to it.

If someone thinks that Emacs itself needs such a command
and key then s?he can propose it.  But there is zero reason
to co-opt this fine feature by replacing it by something else.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24184; Package emacs. (Sun, 15 Aug 2021 12:26:02 GMT) Full text and rfc822 format available.

Message #17 received at 24184 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: Gereon Kaiping <gereon.kaiping <at> gmail.com>, 24184 <at> debbugs.gnu.org,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote
 or properly separate file names
Date: Sun, 15 Aug 2021 14:24:48 +0200
Drew Adams <drew.adams <at> oracle.com> writes:

>> I think filenames should be quoted only when really necessary.  IOW,
>> only if (not (equal (shell-quote-argument "this file") "this file"))
>> but not when (equal (shell-quote-argument "this-file") "this-file").
>
> Even stronger than that.  There is no reason to suppose
> that everyone wants to yank the text only in contexts
> where it should be double-quoted.

Indeed -- we can't surmise what the user is going to use the file name
for, and in some contexts the user must quote the result (in different
ways), and in others the user doesn't.

So on reflection, I don't think there's anything we can do here that
would be useful.  We could add a new command --
`dired-copy-file-names-as-a-list-of-lisp-strings' -- but it doesn't
really sound vital.  So I'm closing this bug report.

(If somebody wants to add
`dired-copy-file-names-as-a-list-of-lisp-strings', I wouldn't oppose
that.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 15 Aug 2021 12:26:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 24184 <at> debbugs.gnu.org and Gereon Kaiping <gereon.kaiping <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 15 Aug 2021 12:26:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 13 Sep 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.