Subject: RE: [External] : bug#48657: Defvar delimiter for dired-copy-filename-as-kill

From: Drew Adams <[email-masked]>
Date: Tue, 25 May 2021 19:44:13 +0000

> Because the space is used as the delimiter for the
> copied filenames, it is difficult (nearly impossible) to know the
> beginning and end of the copied filenames.
> 
> I looked at the source code of the function and found that the space
> character is hardcoded as the delimiter (see below)....
> 
> I thought that it would be useful to have a defvar that allows
> specifying the delimiter for copied filenames through the mentioned
> function. Perhaps, its name could be "dired-copy-filename-delimiter".

Yes.  This was reported by a Dired+ user a while back.
Dired+ fixed it this way, FWIW: Added two defvars, and
updated the command to use one as the separator and the
other to hold the text that's copied to the kill ring.

The second defvar is there so you can obtain the text
even after the kill ring is modified.  For example,
command `diredp-yank-files' uses the value of that var,
not whatever is currently at the head of the kill ring.
And `diredp-move-files-named-in-kill-ring' uses it to
move files to the current dir.

(`dired-yank-files' yanks files to a directory.  It
looks first for files via `interprogram-paste-function',
then it looks in that defvar.)
___

(defvar diredp-last-copied-filenames ()
  "String list of file names last copied to the `kill-ring'.
Copying is done by `dired-copy-filename-as-kill' and related commands.")

(defvar diredp-filename-separator (copy-sequence "\000") ; "^@"
  ;; Should contain only chars that are invalid in a file name.
  "String used to separate file names in a `kill-ring' entry.")