Mercurial > emacs
comparison src/dired.c @ 4778:76f267188bbd
(file_name_completion): Install case-preserving changes from Emacs 18
for completion_ignore_case.
(completion_ignore_case): Declare.
author | Brian Fox <bfox@gnu.org> |
---|---|
date | Wed, 22 Sep 1993 18:25:03 +0000 |
parents | 1fc792473491 |
children | c3677267e74d |
comparison
equal
deleted
inserted
replaced
4777:21ed9c9bb210 | 4778:76f267188bbd |
---|---|
78 | 78 |
79 #ifndef S_IFLNK | 79 #ifndef S_IFLNK |
80 #define lstat stat | 80 #define lstat stat |
81 #endif | 81 #endif |
82 | 82 |
83 extern int completion_ignore_case; | |
83 extern Lisp_Object Ffind_file_name_handler (); | 84 extern Lisp_Object Ffind_file_name_handler (); |
84 | 85 |
85 Lisp_Object Vcompletion_ignored_extensions; | 86 Lisp_Object Vcompletion_ignored_extensions; |
86 | 87 |
87 Lisp_Object Qcompletion_ignore_case; | 88 Lisp_Object Qcompletion_ignore_case; |
390 p1 = XSTRING (bestmatch)->data; | 391 p1 = XSTRING (bestmatch)->data; |
391 p2 = (unsigned char *) dp->d_name; | 392 p2 = (unsigned char *) dp->d_name; |
392 matchsize = scmp(p1, p2, compare); | 393 matchsize = scmp(p1, p2, compare); |
393 if (matchsize < 0) | 394 if (matchsize < 0) |
394 matchsize = compare; | 395 matchsize = compare; |
395 /* If this dirname all matches, | 396 if (completion_ignore_case) |
396 see if implicit following slash does too. */ | 397 { |
398 /* If this is an exact match except for case, | |
399 use it as the best match rather than one that is not | |
400 an exact match. This way, we get the case pattern | |
401 of the actual match. */ | |
402 if ((matchsize == len | |
403 && matchsize + !!directoryp | |
404 < XSTRING (bestmatch)->size) | |
405 || | |
406 /* If there is no exact match ignoring case, | |
407 prefer a match that does not change the case | |
408 of the input. */ | |
409 (((matchsize == len) | |
410 == | |
411 (matchsize + !!directoryp | |
412 == XSTRING (bestmatch)->size)) | |
413 /* If there is more than one exact match aside from | |
414 case, and one of them is exact including case, | |
415 prefer that one. */ | |
416 && !bcmp (p2, XSTRING (file)->data, XSTRING (file)->size) | |
417 && bcmp (p1, XSTRING (file)->data, XSTRING (file)->size))) | |
418 { | |
419 bestmatch = make_string (dp->d_name, len); | |
420 if (directoryp) | |
421 bestmatch = Ffile_name_as_directory (bestmatch); | |
422 } | |
423 } | |
424 | |
425 /* If this dirname all matches, see if implicit following | |
426 slash does too. */ | |
397 if (directoryp | 427 if (directoryp |
398 && compare == matchsize | 428 && compare == matchsize |
399 && bestmatchsize > matchsize | 429 && bestmatchsize > matchsize |
400 && p1[matchsize] == '/') | 430 && p1[matchsize] == '/') |
401 matchsize++; | 431 matchsize++; |
402 bestmatchsize = min (matchsize, bestmatchsize); | 432 bestmatchsize = matchsize; |
403 } | 433 } |
404 } | 434 } |
405 } | 435 } |
406 closedir (d); | 436 closedir (d); |
407 } | 437 } |