Subject: Re: bug#22169: 25.0.50; File name compiletion doesn't work with non-ASCII characters on OS X

From: Eli Zaretskii <[email-masked]>
Date: Wed, 16 Dec 2015 12:17:44 +0200

> From: Random832 <[email-masked]>
> Date: Wed, 16 Dec 2015 00:05:40 -0500
> 
> Anders, can you try this again from a clean emacs -Q session, and in
> particular load ucs-normalize and set the coding system to utf-8-hfs
> _before_ attempting any completion?

I certainly hope so, thanks for testing.

> Incidentally, I do get one other bit of bizarre behavior
> associated with this.  If I have multiple files that start with
> the same base letter and different (or no) accents, pressing TAB
> _deletes_ that letter.  E.g. files: à1 á2 a3.  C-x C-f a TAB,
> deletes the "a".

I guess some code is not ready to cope with a list of candidate
completions some of which don't match the string-to-complete.  Can you
spot which code causes the deletion, and whether that is somehow
related to file-name-all-completions returning all the 3 file names in
this case?

> I'd expect it to either offer all three filenames, or just a3.

It's not really clear what is correct behavior in this case.  On other
platforms Emacs will return only a3, but HFS+ stores decomposed
characters precisely to allow all 3 to match.  So I think we should
at least cause Emacs return only a3, and ideally also support the
other behavior as an option.

Btw, why is completion-ignore-case nil on HFS+?  I understand it's a
case-insensitive file system, isn't it?

> Why exactly does completion do matching with encoded prefix
> against raw filenames, rather than with unicode prefix against
> decoded filenames, anyway?

Performance: we don't want to decode every file name that readdir
returns.