Subject: bug#40625: 28.0.50; fido-mode cannot match candidates containing a space

From: Dmitry Gutov <[email-masked]>
Date: Wed, 15 Apr 2020 02:06:48 +0300

Thanks for the report.

I can reproduce all three.

FWIW, the "bare" icomplete-mode works fine in these cases.

On 14.04.2020 19:01, Omar Antolín Camarena wrote:
> Here are 3 scenarios I tested with fido-mode starting from emacs -Q (all of these work perfectly with icomplete):
> 
> 1. Files with spaces.
> 
> Run emacs -Q and use `M-x fido-mode' to activate fido-mode.
> Create a file with a space in the name. Use find-file to try to open it. As soon as you have a space in the minibuffer, it says "[No matches]".
> 
> For example, I created a file called "one two", and no other file in my home directory starts with "one". In find-file when I type "one" I see the expected result: "~/one[ two] [Matched]".
> 
> If I press TAB to complete I get "one two [No matches]" (from there I can press RET to open the file, this bug report is about the "[No matches]" which is
> clearly wrong).
> 
> If after entering "one" I press space, I get "one  [No matches]", that it, I no longer get offered the "one two" completion.
> 
> 2. Directories with spaces.
> 
> In emacs -Q use `M-x fido-mode' to activate fido-mode.
> Create a directory with a space in the name. I created a directory called "a b" and put a file called "c" inside. If I run find-file and type "a " (that's a followed by space), I see "~/a [No matches]". Even typing "a b/" gives me "~/a b/  [No matches]", and neither TAB nor C-M-i (icomplete-force-complete) will complete the file "~/a b/c".
> 
> 3. Menu entries in an info buffer.
> 
> In emacs -Q use `M-x fido-mode' to activate fido-mode.
> Use `C-h i' to open the main info directory, pick an entry with a space in it. I have a "Date input format" entry from coreutils, for example. Use `m' (bound to Info-menu) and type "Date". fido-mode does offer me the relevant completions, and in my case, "Date input format" is the only one where "Date" is followed by a space. If I type the space nothing happens (space is bound to minibuffer-complete-word), no space is entered, the candidates don't change. Pressing space again pops up the completions buffer.
> 
> If I use `C-q SPC` to insert a literal space, I get "Date  (No matches)".
> 
> If I skip the space and keep typing "inpu", it matches "Date input format", but pressing TAB to complete it to the full "Date input format" again says "(No matches)" ---pressing RET will however open the correct manual.
> 
> ----------
> 
> This was initially meant to be a bug report for `icomplete-fido-backward-updir', whose source code I read (but didn't run). It uses `backward-kill-sexp', which means it won't fully go up a directory if it has spaces in it. I suggest replacing (backward-kill-sexp 1) with (zap-up-to-char -1 ?/), as follows:
> 
> (defun icomplete-fido-backward-updir ()
>    "Delete char before or go up directory, like `ido-mode'."
>    (interactive)
>    (if (and (eq (char-before) ?/)
>             (eq (icomplete--category) 'file))
>        (zap-up-to-char -1 ?/)
>      (call-interactively 'backward-delete-char)))
> 
> Before submitting that report I decided to test fido-mode and discovered it has more fundamental problems with spaces than that.:)