all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names
@ 2016-08-08 14:08 Gereon Kaiping
  2018-04-15 23:13 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Gereon Kaiping @ 2016-08-08 14:08 UTC (permalink / raw)
  To: 24184

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names
  2016-08-08 14:08 bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names Gereon Kaiping
@ 2018-04-15 23:13 ` Lars Ingebrigtsen
  2018-04-16 20:40   ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2018-04-15 23:13 UTC (permalink / raw)
  To: Gereon Kaiping; +Cc: 24184

Gereon Kaiping <gereon.kaiping@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names
  2018-04-15 23:13 ` Lars Ingebrigtsen
@ 2018-04-16 20:40   ` Juri Linkov
  2018-04-16 22:35     ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2018-04-16 20:40 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Gereon Kaiping, 24184

>> $ 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").





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names
  2018-04-16 20:40   ` Juri Linkov
@ 2018-04-16 22:35     ` Drew Adams
  2021-08-15 12:24       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2018-04-16 22:35 UTC (permalink / raw)
  To: Juri Linkov, Lars Ingebrigtsen; +Cc: Gereon Kaiping, 24184

> 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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names
  2018-04-16 22:35     ` Drew Adams
@ 2021-08-15 12:24       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-15 12:24 UTC (permalink / raw)
  To: Drew Adams; +Cc: Gereon Kaiping, 24184, Juri Linkov

Drew Adams <drew.adams@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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-15 12:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-08 14:08 bug#24184: 25.0.94; dired-copy-filename-as-kill does not quote or properly separate file names Gereon Kaiping
2018-04-15 23:13 ` Lars Ingebrigtsen
2018-04-16 20:40   ` Juri Linkov
2018-04-16 22:35     ` Drew Adams
2021-08-15 12:24       ` Lars Ingebrigtsen

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.