Mercurial > hg > xemacs-beta
comparison src/dired.c @ 20:859a2309aef8 r19-15b93
Import from CVS: tag r19-15b93
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:50:05 +0200 |
parents | 0293115a14e9 |
children | 8d2a9b52c682 |
comparison
equal
deleted
inserted
replaced
19:ac1f612d5250 | 20:859a2309aef8 |
---|---|
36 Lisp_Object Qdirectory_files; | 36 Lisp_Object Qdirectory_files; |
37 Lisp_Object Qfile_name_completion; | 37 Lisp_Object Qfile_name_completion; |
38 Lisp_Object Qfile_name_all_completions; | 38 Lisp_Object Qfile_name_all_completions; |
39 Lisp_Object Qfile_attributes; | 39 Lisp_Object Qfile_attributes; |
40 | 40 |
41 DEFUN ("directory-files", Fdirectory_files, Sdirectory_files, 1, 5, 0 /* | 41 DEFUN ("directory-files", Fdirectory_files, 1, 5, 0, /* |
42 Return a list of names of files in DIRECTORY. | 42 Return a list of names of files in DIRECTORY. |
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. |
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 */ |
54 (dirname, full, match, nosort, files_only) | 54 (dirname, full, match, nosort, files_only)) |
55 Lisp_Object dirname, full, match, nosort, files_only; | |
56 { | 55 { |
57 /* This function can GC */ | 56 /* This function can GC */ |
58 DIR *d; | 57 DIR *d; |
59 Bytecount dirname_length; | 58 Bytecount dirname_length; |
60 Lisp_Object list, name, dirfilename = Qnil; | 59 Lisp_Object list, name, dirfilename = Qnil; |
210 | 209 |
211 static Lisp_Object file_name_completion (Lisp_Object file, | 210 static Lisp_Object file_name_completion (Lisp_Object file, |
212 Lisp_Object dirname, | 211 Lisp_Object dirname, |
213 int all_flag, int ver_flag); | 212 int all_flag, int ver_flag); |
214 | 213 |
215 DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion, | 214 DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /* |
216 2, 2, 0 /* | |
217 Complete file name FILE in directory DIR. | 215 Complete file name FILE in directory DIR. |
218 Returns the longest string common to all filenames in DIR | 216 Returns the longest string common to all filenames in DIR |
219 that start with FILE. | 217 that start with FILE. |
220 If there is only one and FILE matches it exactly, returns t. | 218 If there is only one and FILE matches it exactly, returns t. |
221 Returns nil if DIR contains no name starting with FILE. | 219 Returns nil if DIR contains no name starting with FILE. |
222 | 220 |
223 Filenames which end with any member of `completion-ignored-extensions' | 221 Filenames which end with any member of `completion-ignored-extensions' |
224 are not considered as possible completions for FILE unless there is no | 222 are not considered as possible completions for FILE unless there is no |
225 other possible completion. `completion-ignored-extensions' is not applied | 223 other possible completion. `completion-ignored-extensions' is not applied |
226 to the names of directories. | 224 to the names of directories. |
227 */ ) | 225 */ |
228 (file, dirname) | 226 (file, dirname)) |
229 Lisp_Object file, dirname; | |
230 { | 227 { |
231 /* This function can GC */ | 228 /* This function can GC */ |
232 Lisp_Object handler; | 229 Lisp_Object handler; |
233 | 230 |
234 /* If the directory name has special constructs in it, | 231 /* If the directory name has special constructs in it, |
244 return call3 (handler, Qfile_name_completion, file, dirname); | 241 return call3 (handler, Qfile_name_completion, file, dirname); |
245 | 242 |
246 return file_name_completion (file, dirname, 0, 0); | 243 return file_name_completion (file, dirname, 0, 0); |
247 } | 244 } |
248 | 245 |
249 DEFUN ("file-name-all-completions", Ffile_name_all_completions, | 246 DEFUN ("file-name-all-completions", Ffile_name_all_completions, 2, 2, 0, /* |
250 Sfile_name_all_completions, 2, 2, 0 /* | |
251 Return a list of all completions of file name FILE in directory DIR. | 247 Return a list of all completions of file name FILE in directory DIR. |
252 These are all file names in directory DIR which begin with FILE. | 248 These are all file names in directory DIR which begin with FILE. |
253 | 249 |
254 Filenames which end with any member of `completion-ignored-extensions' | 250 Filenames which end with any member of `completion-ignored-extensions' |
255 are not considered as possible completions for FILE unless there is no | 251 are not considered as possible completions for FILE unless there is no |
256 other possible completion. `completion-ignored-extensions' is not applied | 252 other possible completion. `completion-ignored-extensions' is not applied |
257 to the names of directories. | 253 to the names of directories. |
258 */ ) | 254 */ |
259 (file, dirname) | 255 (file, dirname)) |
260 Lisp_Object file, dirname; | |
261 { | 256 { |
262 /* This function can GC */ | 257 /* This function can GC */ |
263 Lisp_Object handler; | 258 Lisp_Object handler; |
264 | 259 |
265 /* If the file name has special constructs in it, | 260 /* If the file name has special constructs in it, |
544 return hash; | 539 return hash; |
545 } | 540 } |
546 | 541 |
547 #ifdef VMS | 542 #ifdef VMS |
548 | 543 |
549 DEFUN ("file-name-all-versions", Ffile_name_all_versions, | 544 DEFUN ("file-name-all-versions", Ffile_name_all_versions, 2, 2, 0, /* |
550 Sfile_name_all_versions, 2, 2, 0 /* | |
551 Return a list of all versions of file name FILE in directory DIR. | 545 Return a list of all versions of file name FILE in directory DIR. |
552 */ ) | 546 */ |
553 (file, dirname) | 547 (file, dirname)) |
554 Lisp_Object file, dirname; | |
555 { | 548 { |
556 /* This function can GC */ | 549 /* This function can GC */ |
557 return file_name_completion (file, dirname, 1, 1); | 550 return file_name_completion (file, dirname, 1, 1); |
558 } | 551 } |
559 | 552 |
560 DEFUN ("file-version-limit", Ffile_version_limit, Sfile_version_limit, 1, 1, 0 /* | 553 DEFUN ("file-version-limit", Ffile_version_limit, 1, 1, 0, /* |
561 Return the maximum number of versions allowed for FILE. | 554 Return the maximum number of versions allowed for FILE. |
562 Returns nil if the file cannot be opened or if there is no version limit. | 555 Returns nil if the file cannot be opened or if there is no version limit. |
563 */ ) | 556 */ |
564 (filename) | 557 (filename)) |
565 Lisp_Object filename; | |
566 { | 558 { |
567 /* This function can GC */ | 559 /* This function can GC */ |
568 Lisp_Object retval; | 560 Lisp_Object retval; |
569 struct FAB fab; | 561 struct FAB fab; |
570 struct RAB rab; | 562 struct RAB rab; |
599 Lisp_Object cons = word_to_lisp (item); | 591 Lisp_Object cons = word_to_lisp (item); |
600 XCDR (cons) = Fcons (XCDR (cons), Qnil); | 592 XCDR (cons) = Fcons (XCDR (cons), Qnil); |
601 return cons; | 593 return cons; |
602 } | 594 } |
603 | 595 |
604 DEFUN ("file-attributes", Ffile_attributes, Sfile_attributes, 1, 1, 0 /* | 596 DEFUN ("file-attributes", Ffile_attributes, 1, 1, 0, /* |
605 Return a list of attributes of file FILENAME. | 597 Return a list of attributes of file FILENAME. |
606 Value is nil if specified file cannot be opened. | 598 Value is nil if specified file cannot be opened. |
607 Otherwise, list elements are: | 599 Otherwise, list elements are: |
608 0. t for directory, string (name linked to) for symbolic link, or nil. | 600 0. t for directory, string (name linked to) for symbolic link, or nil. |
609 1. Number of links to file. | 601 1. Number of links to file. |
618 9. t iff file's gid would change if file were deleted and recreated. | 610 9. t iff file's gid would change if file were deleted and recreated. |
619 10. inode number. | 611 10. inode number. |
620 11. Device number. | 612 11. Device number. |
621 | 613 |
622 If file does not exist, returns nil. | 614 If file does not exist, returns nil. |
623 */ ) | 615 */ |
624 (filename) | 616 (filename)) |
625 Lisp_Object filename; | |
626 { | 617 { |
627 /* This function can GC */ | 618 /* This function can GC */ |
628 Lisp_Object values[12]; | 619 Lisp_Object values[12]; |
629 Lisp_Object dirname = Qnil; | 620 Lisp_Object dirname = Qnil; |
630 struct stat s; | 621 struct stat s; |
736 defsymbol (&Qdirectory_files, "directory-files"); | 727 defsymbol (&Qdirectory_files, "directory-files"); |
737 defsymbol (&Qfile_name_completion, "file-name-completion"); | 728 defsymbol (&Qfile_name_completion, "file-name-completion"); |
738 defsymbol (&Qfile_name_all_completions, "file-name-all-completions"); | 729 defsymbol (&Qfile_name_all_completions, "file-name-all-completions"); |
739 defsymbol (&Qfile_attributes, "file-attributes"); | 730 defsymbol (&Qfile_attributes, "file-attributes"); |
740 | 731 |
741 defsubr (&Sdirectory_files); | 732 DEFSUBR (Fdirectory_files); |
742 defsubr (&Sfile_name_completion); | 733 DEFSUBR (Ffile_name_completion); |
743 #ifdef VMS | 734 #ifdef VMS |
744 defsubr (&Sfile_name_all_versions); | 735 DEFSUBR (Ffile_name_all_versions); |
745 defsubr (&Sfile_version_limit); | 736 DEFSUBR (Ffile_version_limit); |
746 #endif /* VMS */ | 737 #endif /* VMS */ |
747 defsubr (&Sfile_name_all_completions); | 738 DEFSUBR (Ffile_name_all_completions); |
748 defsubr (&Sfile_attributes); | 739 DEFSUBR (Ffile_attributes); |
749 } | 740 } |
750 | 741 |
751 void | 742 void |
752 vars_of_dired (void) | 743 vars_of_dired (void) |
753 { | 744 { |