comparison src/dired.c @ 185:3d6bfa290dbd r20-3b19

Import from CVS: tag r20-3b19
author cvs
date Mon, 13 Aug 2007 09:55:28 +0200
parents 8eaf7971accc
children a2f645c6b9f8
comparison
equal deleted inserted replaced
184:bcd2674570bf 185:3d6bfa290dbd
43 There are four optional arguments: 43 There are four optional arguments:
44 If FULL is non-nil, absolute pathnames of the files are returned. 44 If FULL is non-nil, absolute pathnames of the files are returned.
45 If MATCH is non-nil, only pathnames containing that regexp are returned. 45 If MATCH is non-nil, only pathnames containing that regexp are returned.
46 If NOSORT is non-nil, the list is not sorted--its order is unpredictable. 46 If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
47 NOSORT is useful if you plan to sort the result yourself. 47 NOSORT is useful if you plan to sort the result yourself.
48 If FILES-ONLY is the symbol t, then only the \"files\" in the directory 48 If FILES-ONLY is the symbol t, then only the "files" in the directory
49 will be returned; subdirectories will be excluded. If FILES-ONLY is not 49 will be returned; subdirectories will be excluded. If FILES-ONLY is not
50 nil and not t, then only the subdirectories will be returned. Otherwise, 50 nil and not t, then only the subdirectories will be returned. Otherwise,
51 if FILES-ONLY is nil (the default) then both files and subdirectories will 51 if FILES-ONLY is nil (the default) then both files and subdirectories will
52 be returned. 52 be returned.
53 */ 53 */
205 if (!NILP (nosort)) 205 if (!NILP (nosort))
206 return list; 206 return list;
207 return Fsort (Fnreverse (list), Qstring_lessp); 207 return Fsort (Fnreverse (list), Qstring_lessp);
208 } 208 }
209 209
210 static Lisp_Object file_name_completion (Lisp_Object file, 210 static Lisp_Object file_name_completion (Lisp_Object file,
211 Lisp_Object dirname, 211 Lisp_Object dirname,
212 int all_flag, int ver_flag); 212 int all_flag, int ver_flag);
213 213
214 DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /* 214 DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /*
215 Complete file name FILE in directory DIR. 215 Complete file name FILE in directory DIR.
216 Returns the longest string common to all filenames in DIR 216 Returns the longest string common to all filenames in DIR
471 /* If this is an exact match except for case, 471 /* If this is an exact match except for case,
472 use it as the best match rather than one that is not 472 use it as the best match rather than one that is not
473 an exact match. This way, we get the case pattern 473 an exact match. This way, we get the case pattern
474 of the actual match. */ 474 of the actual match. */
475 if ((matchsize == cclen 475 if ((matchsize == cclen
476 && matchsize + !!directoryp 476 && matchsize + !!directoryp
477 < string_char_length (XSTRING (bestmatch))) 477 < string_char_length (XSTRING (bestmatch)))
478 || 478 ||
479 /* If there is no exact match ignoring case, 479 /* If there is no exact match ignoring case,
480 prefer a match that does not change the case 480 prefer a match that does not change the case
481 of the input. */ 481 of the input. */
482 (((matchsize == cclen) 482 (((matchsize == cclen)
483 == 483 ==
484 (matchsize + !!directoryp 484 (matchsize + !!directoryp
485 == string_char_length (XSTRING (bestmatch)))) 485 == string_char_length (XSTRING (bestmatch))))
486 /* If there is more than one exact match aside from 486 /* If there is more than one exact match aside from
487 case, and one of them is exact including case, 487 case, and one of them is exact including case,
488 prefer that one. */ 488 prefer that one. */
489 && 0 > scmp_1 (p2, XSTRING_DATA (file), 489 && 0 > scmp_1 (p2, XSTRING_DATA (file),
652 #ifdef MSDOS 652 #ifdef MSDOS
653 { 653 {
654 char *tmpnam = (char *) XSTRING_DATA (Ffile_name_nondirectory (filename)); 654 char *tmpnam = (char *) XSTRING_DATA (Ffile_name_nondirectory (filename));
655 int l = strlen (tmpnam); 655 int l = strlen (tmpnam);
656 656
657 if (l >= 5 657 if (l >= 5
658 && S_ISREG (s.st_mode) 658 && S_ISREG (s.st_mode)
659 && (stricmp (&tmpnam[l - 4], ".com") == 0 || 659 && (stricmp (&tmpnam[l - 4], ".com") == 0 ||
660 stricmp (&tmpnam[l - 4], ".exe") == 0 || 660 stricmp (&tmpnam[l - 4], ".exe") == 0 ||
661 stricmp (&tmpnam[l - 4], ".bat") == 0)) 661 stricmp (&tmpnam[l - 4], ".bat") == 0))
662 { 662 {