comparison src/dired.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 966663fcf606
children 6330739388db
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
26 #include "buffer.h" 26 #include "buffer.h"
27 #include "commands.h" 27 #include "commands.h"
28 #include "elhash.h" 28 #include "elhash.h"
29 #include "regex.h" 29 #include "regex.h"
30 #include "opaque.h" 30 #include "opaque.h"
31
32 #include "sysfile.h" 31 #include "sysfile.h"
33 #include "sysdir.h" 32 #include "sysdir.h"
34 33
35 Lisp_Object Vcompletion_ignored_extensions; 34 Lisp_Object Vcompletion_ignored_extensions;
36
37 Lisp_Object Qdirectory_files; 35 Lisp_Object Qdirectory_files;
38 Lisp_Object Qfile_name_completion; 36 Lisp_Object Qfile_name_completion;
39 Lisp_Object Qfile_name_all_completions; 37 Lisp_Object Qfile_name_all_completions;
40 Lisp_Object Qfile_attributes; 38 Lisp_Object Qfile_attributes;
41 39
333 331
334 #ifdef FILE_SYSTEM_CASE 332 #ifdef FILE_SYSTEM_CASE
335 file = FILE_SYSTEM_CASE (file); 333 file = FILE_SYSTEM_CASE (file);
336 #endif 334 #endif
337 dirname = Fexpand_file_name (dirname, Qnil); 335 dirname = Fexpand_file_name (dirname, Qnil);
338 file_name_length = string_char_length (XSTRING (file)); 336 file_name_length = XSTRING_CHAR_LENGTH (file);
339 337
340 /* With passcount = 0, ignore files that end in an ignored extension. 338 /* With passcount = 0, ignore files that end in an ignored extension.
341 If nothing found then try again with passcount = 1, don't ignore them. 339 If nothing found then try again with passcount = 1, don't ignore them.
342 If looking for all completions, start with passcount = 1, 340 If looking for all completions, start with passcount = 1,
343 so always take even the ignored ones. 341 so always take even the ignored ones.
416 Lisp_Object elt = XCAR (tem); 414 Lisp_Object elt = XCAR (tem);
417 Charcount skip; 415 Charcount skip;
418 416
419 CHECK_STRING (elt); 417 CHECK_STRING (elt);
420 418
421 skip = cclen - string_char_length (XSTRING (elt)); 419 skip = cclen - XSTRING_CHAR_LENGTH (elt);
422 if (skip < 0) continue; 420 if (skip < 0) continue;
423 421
424 if (0 > scmp (charptr_n_addr (d_name, skip), 422 if (0 > scmp (charptr_n_addr (d_name, skip),
425 XSTRING_DATA (elt), 423 XSTRING_DATA (elt),
426 string_char_length (XSTRING (elt)))) 424 XSTRING_CHAR_LENGTH (elt)))
427 { 425 {
428 ignored_extension_p = 1; 426 ignored_extension_p = 1;
429 break; 427 break;
430 } 428 }
431 } 429 }
457 bestmatch = Fcons (name, bestmatch); 455 bestmatch = Fcons (name, bestmatch);
458 } 456 }
459 else 457 else
460 { 458 {
461 bestmatch = name; 459 bestmatch = name;
462 bestmatchsize = string_char_length (XSTRING (name)); 460 bestmatchsize = XSTRING_CHAR_LENGTH (name);
463 } 461 }
464 NUNGCPRO; 462 NUNGCPRO;
465 } 463 }
466 else 464 else
467 { 465 {
478 use it as the best match rather than one that is not 476 use it as the best match rather than one that is not
479 an exact match. This way, we get the case pattern 477 an exact match. This way, we get the case pattern
480 of the actual match. */ 478 of the actual match. */
481 if ((matchsize == cclen 479 if ((matchsize == cclen
482 && matchsize + !!directoryp 480 && matchsize + !!directoryp
483 < string_char_length (XSTRING (bestmatch))) 481 < XSTRING_CHAR_LENGTH (bestmatch))
484 || 482 ||
485 /* If there is no exact match ignoring case, 483 /* If there is no exact match ignoring case,
486 prefer a match that does not change the case 484 prefer a match that does not change the case
487 of the input. */ 485 of the input. */
488 (((matchsize == cclen) 486 (((matchsize == cclen)
489 == 487 ==
490 (matchsize + !!directoryp 488 (matchsize + !!directoryp
491 == string_char_length (XSTRING (bestmatch)))) 489 == XSTRING_CHAR_LENGTH (bestmatch)))
492 /* If there is more than one exact match aside from 490 /* If there is more than one exact match aside from
493 case, and one of them is exact including case, 491 case, and one of them is exact including case,
494 prefer that one. */ 492 prefer that one. */
495 && 0 > scmp_1 (p2, XSTRING_DATA (file), 493 && 0 > scmp_1 (p2, XSTRING_DATA (file),
496 file_name_length, 0) 494 file_name_length, 0)
652 values[6] = wasteful_word_to_lisp (s.st_ctime); 650 values[6] = wasteful_word_to_lisp (s.st_ctime);
653 values[7] = make_int ((EMACS_INT) s.st_size); 651 values[7] = make_int ((EMACS_INT) s.st_size);
654 /* If the size is out of range, give back -1. */ 652 /* If the size is out of range, give back -1. */
655 /* #### Fix when Emacs gets bignums! */ 653 /* #### Fix when Emacs gets bignums! */
656 if (XINT (values[7]) != s.st_size) 654 if (XINT (values[7]) != s.st_size)
657 XSETINT (values[7], -1); 655 values[7] = make_int (-1);
658 filemodestring (&s, modes); 656 filemodestring (&s, modes);
659 values[8] = make_string ((Bufbyte *) modes, 10); 657 values[8] = make_string ((Bufbyte *) modes, 10);
660 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ 658 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */
661 { 659 {
662 struct stat sdir; 660 struct stat sdir;