[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File name completion with non-ascii filenames
From: |
Kenichi Handa |
Subject: |
Re: File name completion with non-ascii filenames |
Date: |
Fri, 21 Dec 2001 09:04:09 +0900 (JST) |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.1.30 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI) |
"Eli Zaretskii" <address@hidden> writes:
>> From: Richard Stallman <address@hidden>
>> Date: Tue, 18 Dec 2001 22:59:50 -0700 (MST)
>>
>> + static int
>> + scmp (s1, s2, len)
>> + register unsigned char *s1, *s2;
>> + int len;
>> + {
>> + register int l = len;
>> +
>> + if (completion_ignore_case)
>> + {
>> + while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++))
>> + l--;
>> + }
> Is this the proper way of comparing unibyte characters
> case-insensitively? That is, are the tables used by DOWNCASE set up
> for unibyte characters as well?
> Come to think about this, what does completion_ignore_case have to do
> with comparing file names? I think it's not relevant, so I think we
> should remove the case-insensitive branch.
The case-table is setup correctly for 8-bit characters in
each language environment. But, FILE arg of
file_name_completion may contain multibyte characters that
can't be encoded by file-name-coding-system. In that case,
ENCODE_FILE produces inproper unibyte string that will match
with a filename incorrectly.
The general strategy of Emacs for comparing unibyte and
multibyte string is to convert or decode unibyte string to
multibyte.
So, in file_name_completion also, instead of encoding FILE,
we should decode each filenames in the directory by
file-name-coding-system, and use Fstring_compare.
---
Ken'ichi HANDA
address@hidden