Subject: Re: bug#13165: Fwd: Newlines in file names

From: Whitfield Diffie <[email-masked]>
Date: Fri, 14 Dec 2012 21:33:28 -0800

>>     In emacs 22.1.1, if you have a file whose name contains a carriage
>> return and put the cursor on the line with that file in dired, then
>> (file-exists-p (dired-get-filename)) is nil.
>
> It works fine if you add -b to dired-listing-switches.

    I find it hard to see (null (file-exists-p (dired-get-filename)))
as anything but a bug; if -b didn't put the filenames in the right
form, dired should have done so.

    I am, however, very grateful to you for setting me on the right
path.  My problem was code in dired-insert-directory that reformats
filenames if it does not find b in the listing-switches.  Your message
put me on the right track and I have solved the problem.  Thank you.

    What I am working with is a substantially revised dired, e.g.,

 /Users/diffie/system/emacs/local/dired-mods:

  dr-x   10  29Oct12 17:10:33  dired-sort-halves.el
  dr-x   16  27Oct12 18:16:51  dired-sorting.el

  -r-- 2006  22Apr09 07:41:09  directory-needs-reversion-p.el
  -r-- 4714   7Feb12 20:19:43  dired-add-entry.el
  -r--  418  20Jun06 22:16:47  dired-add-file.el
  -r--  939  18Mar07 21:06:53  dired-add-zero-in-filename.el
  -r--  594  30Nov11 11:06:45  dired-approximate-position.el
  -r--  231   7Feb12 19:58:01  dired-at-headerline.el

in which there are numerous format switches.  (Anyone who is
interested,  is naturally welcome to it; I haven't compared it with
dired in later versions of Emacs.)

>   emacs-22.1 -Q --eval '(setq dired-listing-switches "-alb")'
> This was a suggestion when this was a help request:

    If it was a response to my help request, it didn't reach me.

> I see no prospect of Dired handling file names with newlines without the
> -b switch in use.

    My dired doesn't depend on ls.  I does use it at present but I
think directory-files would do just as well.

                                       Thanks again,

                                                             Whit