mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-31 11:13:50 +00:00
(file_name_completion): Fix inappropriate mixing of
encoded and decoded names.
This commit is contained in:
parent
87bdd2c7a5
commit
9c691c002b
@ -1,5 +1,8 @@
|
|||||||
2008-04-27 Andreas Schwab <schwab@suse.de>
|
2008-04-27 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
|
* dired.c (file_name_completion): Fix inappropriate mixing of
|
||||||
|
encoded and decoded names.
|
||||||
|
|
||||||
* xterm.c (XTread_socket): Fix use of uninitialized variable.
|
* xterm.c (XTread_socket): Fix use of uninitialized variable.
|
||||||
|
|
||||||
* puresize.h (BASE_PURESIZE): Increase to 1200000.
|
* puresize.h (BASE_PURESIZE): Increase to 1200000.
|
||||||
|
25
src/dired.c
25
src/dired.c
@ -539,6 +539,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
{
|
{
|
||||||
DIRENTRY *dp;
|
DIRENTRY *dp;
|
||||||
int len;
|
int len;
|
||||||
|
Lisp_Object decoded_name;
|
||||||
|
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
dp = (*readfunc) (d);
|
dp = (*readfunc) (d);
|
||||||
@ -640,6 +641,9 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
if (!passcount && CONSP (tem))
|
if (!passcount && CONSP (tem))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
name = make_unibyte_string (dp->d_name, len);
|
||||||
|
decoded_name = DECODE_FILE (name);
|
||||||
|
|
||||||
if (!passcount)
|
if (!passcount)
|
||||||
{
|
{
|
||||||
Lisp_Object regexps;
|
Lisp_Object regexps;
|
||||||
@ -650,8 +654,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
|
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
|
||||||
regexps = XCDR (regexps))
|
regexps = XCDR (regexps))
|
||||||
{
|
{
|
||||||
tem = Fstring_match (XCAR (regexps),
|
tem = Fstring_match (XCAR (regexps), decoded_name, zero);
|
||||||
make_string (dp->d_name, len), zero);
|
|
||||||
if (NILP (tem))
|
if (NILP (tem))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -663,10 +666,8 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
if (directoryp)
|
if (directoryp)
|
||||||
{
|
{
|
||||||
/* This completion is a directory; make it end with '/' */
|
/* This completion is a directory; make it end with '/' */
|
||||||
name = Ffile_name_as_directory (make_string (dp->d_name, len));
|
name = ENCODE_FILE (Ffile_name_as_directory (decoded_name));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
name = make_string (dp->d_name, len);
|
|
||||||
|
|
||||||
/* Test the predicate, if any. */
|
/* Test the predicate, if any. */
|
||||||
|
|
||||||
@ -674,10 +675,10 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
{
|
{
|
||||||
Lisp_Object decoded;
|
Lisp_Object decoded;
|
||||||
Lisp_Object val;
|
Lisp_Object val;
|
||||||
struct gcpro gcpro1;
|
struct gcpro gcpro1, gcpro2;
|
||||||
|
|
||||||
GCPRO1 (name);
|
GCPRO2 (name, decoded_name);
|
||||||
decoded = Fexpand_file_name (DECODE_FILE (name), dirname);
|
decoded = Fexpand_file_name (decoded_name, dirname);
|
||||||
val = call1 (predicate, decoded);
|
val = call1 (predicate, decoded);
|
||||||
UNGCPRO;
|
UNGCPRO;
|
||||||
|
|
||||||
@ -690,10 +691,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
matchcount++;
|
matchcount++;
|
||||||
|
|
||||||
if (all_flag)
|
if (all_flag)
|
||||||
{
|
bestmatch = Fcons (decoded_name, bestmatch);
|
||||||
name = DECODE_FILE (name);
|
|
||||||
bestmatch = Fcons (name, bestmatch);
|
|
||||||
}
|
|
||||||
else if (NILP (bestmatch))
|
else if (NILP (bestmatch))
|
||||||
{
|
{
|
||||||
bestmatch = name;
|
bestmatch = name;
|
||||||
@ -729,8 +727,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate)
|
|||||||
either both or neither are exact. */
|
either both or neither are exact. */
|
||||||
(((matchsize == len)
|
(((matchsize == len)
|
||||||
==
|
==
|
||||||
(matchsize + !!directoryp
|
(matchsize + !!directoryp == SCHARS (bestmatch)))
|
||||||
== SCHARS (bestmatch)))
|
|
||||||
&& !bcmp (p2, SDATA (encoded_file), SCHARS (encoded_file))
|
&& !bcmp (p2, SDATA (encoded_file), SCHARS (encoded_file))
|
||||||
&& bcmp (p1, SDATA (encoded_file), SCHARS (encoded_file))))
|
&& bcmp (p1, SDATA (encoded_file), SCHARS (encoded_file))))
|
||||||
bestmatch = name;
|
bestmatch = name;
|
||||||
|
Loading…
Reference in New Issue
Block a user