Subject: bug#62096: 30.0.50; find-dired, dired-goto-file and spaces

From: Drew Adams <[email-masked]>
Date: Fri, 10 Mar 2023 15:43:57 +0000

> I've found out that 'dired-goto-file' does not work with file name with
> spaces in them.  It is only in buffers generated by 'find-dired' (it
> works in a "normal" dired buffer).
> 
> How to reproduce:
> 
> --8<---------------cut here---------------start------------->8---
>     emacs -Q --eval "(find-dired \"~\" \"-type f -name \\\"*.jpg\\\"\")"
> 
>     j a-file-name-without-space.jpg       ;; it jumps to the file
>     j vacation 2022/we needed space.jpg   ;; it doesn't
> --8<---------------cut here---------------end--------------->8---
> 
> In GNU Emacs 30.0.50 (build 1, x86_64-unknown-openbsd7.2, cairo version

Good catch.  I can confirm seeing the bug (on
MS Windows) also in 28.2 and older versions.

The problem appears to be in `dired-get-filename'.

FWIW, I also see it in my (Dired+) code, except
that in my code I see it only for a file name
that starts with a space, not also for a name
that just has an embedded space.  E.g, I see the
problem for "  space-prefixed-filename" but not
for file "has embedded space".

Not sure what the right fix would be.