Mercurial > hg > xemacs-beta
comparison src/dired.c @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | 1ccc32a20af4 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
177 static Lisp_Object file_name_completion (Lisp_Object file, | 177 static Lisp_Object file_name_completion (Lisp_Object file, |
178 Lisp_Object directory, | 178 Lisp_Object directory, |
179 int all_flag, int ver_flag); | 179 int all_flag, int ver_flag); |
180 | 180 |
181 DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /* | 181 DEFUN ("file-name-completion", Ffile_name_completion, 2, 2, 0, /* |
182 Complete file name FILE in directory DIRECTORY. | 182 Complete file name PARTIAL-FILENAME in directory DIRECTORY. |
183 Returns the longest string common to all filenames in DIRECTORY | 183 Return the longest prefix common to all file names in DIRECTORY |
184 that start with FILE. | 184 that start with PARTIAL-FILENAME. |
185 If there is only one and FILE matches it exactly, returns t. | 185 If there is only one and PARTIAL-FILENAME matches it exactly, return t. |
186 Returns nil if DIRECTORY contains no name starting with FILE. | 186 Return nil if DIRECTORY contains no name starting with PARTIAL-FILENAME. |
187 | 187 |
188 Filenames which end with any member of `completion-ignored-extensions' | 188 File names which end with any member of `completion-ignored-extensions' |
189 are not considered as possible completions for FILE unless there is no | 189 are not considered as possible completions for PARTIAL-FILENAME unless |
190 other possible completion. `completion-ignored-extensions' is not applied | 190 there is no other possible completion. `completion-ignored-extensions' |
191 to the names of directories. | 191 is not applied to the names of directories. |
192 */ | 192 */ |
193 (file, directory)) | 193 (partial_filename, directory)) |
194 { | 194 { |
195 /* This function can GC. GC checked 1996.04.06. */ | 195 /* This function can GC. GC checked 1996.04.06. */ |
196 Lisp_Object handler; | 196 Lisp_Object handler; |
197 | 197 |
198 /* If the directory name has special constructs in it, | 198 /* If the directory name has special constructs in it, |
199 call the corresponding file handler. */ | 199 call the corresponding file handler. */ |
200 handler = Ffind_file_name_handler (directory, Qfile_name_completion); | 200 handler = Ffind_file_name_handler (directory, Qfile_name_completion); |
201 if (!NILP (handler)) | 201 if (!NILP (handler)) |
202 return call3 (handler, Qfile_name_completion, file, directory); | 202 return call3 (handler, Qfile_name_completion, partial_filename, directory); |
203 | 203 |
204 /* If the file name has special constructs in it, | 204 /* If the file name has special constructs in it, |
205 call the corresponding file handler. */ | 205 call the corresponding file handler. */ |
206 handler = Ffind_file_name_handler (file, Qfile_name_completion); | 206 handler = Ffind_file_name_handler (partial_filename, Qfile_name_completion); |
207 if (!NILP (handler)) | 207 if (!NILP (handler)) |
208 return call3 (handler, Qfile_name_completion, file, directory); | 208 return call3 (handler, Qfile_name_completion, partial_filename, directory); |
209 | 209 |
210 return file_name_completion (file, directory, 0, 0); | 210 return file_name_completion (partial_filename, directory, 0, 0); |
211 } | 211 } |
212 | 212 |
213 DEFUN ("file-name-all-completions", Ffile_name_all_completions, 2, 2, 0, /* | 213 DEFUN ("file-name-all-completions", Ffile_name_all_completions, 2, 2, 0, /* |
214 Return a list of all completions of file name FILE in directory DIRECTORY. | 214 Return a list of all completions of PARTIAL-FILENAME in DIRECTORY. |
215 These are all file names in directory DIRECTORY which begin with FILE. | 215 These are all file names in DIRECTORY which begin with PARTIAL-FILENAME. |
216 | 216 |
217 File names which end with any member of `completion-ignored-extensions' | 217 File names which end with any member of `completion-ignored-extensions' |
218 are not considered as possible completions for FILE unless there is no | 218 are not considered as possible completions for PARTIAL-FILENAME unless |
219 other possible completion. `completion-ignored-extensions' is not applied | 219 there is no other possible completion. `completion-ignored-extensions' |
220 to the names of directories. | 220 is not applied to the names of directories. |
221 */ | 221 */ |
222 (file, directory)) | 222 (partial_filename, directory)) |
223 { | 223 { |
224 /* This function can GC. GC checked 1997.06.04. */ | 224 /* This function can GC. GC checked 1997.06.04. */ |
225 Lisp_Object handler; | 225 Lisp_Object handler; |
226 struct gcpro gcpro1; | 226 struct gcpro gcpro1; |
227 | 227 |
230 /* If the file name has special constructs in it, | 230 /* If the file name has special constructs in it, |
231 call the corresponding file handler. */ | 231 call the corresponding file handler. */ |
232 handler = Ffind_file_name_handler (directory, Qfile_name_all_completions); | 232 handler = Ffind_file_name_handler (directory, Qfile_name_all_completions); |
233 UNGCPRO; | 233 UNGCPRO; |
234 if (!NILP (handler)) | 234 if (!NILP (handler)) |
235 return call3 (handler, Qfile_name_all_completions, file, | 235 return call3 (handler, Qfile_name_all_completions, partial_filename, |
236 directory); | 236 directory); |
237 | 237 |
238 return file_name_completion (file, directory, 1, 0); | 238 return file_name_completion (partial_filename, directory, 1, 0); |
239 } | 239 } |
240 | 240 |
241 static int | 241 static int |
242 file_name_completion_stat (Lisp_Object directory, DIRENTRY *dp, | 242 file_name_completion_stat (Lisp_Object directory, DIRENTRY *dp, |
243 struct stat *st_addr) | 243 struct stat *st_addr) |
514 static Lisp_Object user_name_completion (Lisp_Object user, | 514 static Lisp_Object user_name_completion (Lisp_Object user, |
515 int all_flag, | 515 int all_flag, |
516 int *uniq); | 516 int *uniq); |
517 | 517 |
518 DEFUN ("user-name-completion", Fuser_name_completion, 1, 1, 0, /* | 518 DEFUN ("user-name-completion", Fuser_name_completion, 1, 1, 0, /* |
519 Complete user name USER. | 519 Complete user name from PARTIAL-USERNAME. |
520 | 520 Return the longest prefix common to all user names starting with |
521 Returns the longest string common to all user names that start | 521 PARTIAL-USERNAME. If there is only one and PARTIAL-USERNAME matches |
522 with USER. If there is only one and USER matches it exactly, | 522 it exactly, returns t. Return nil if there is no user name starting |
523 returns t. Returns nil if there is no user name starting with USER. | 523 with PARTIAL-USERNAME. |
524 */ | 524 */ |
525 (user)) | 525 (partial_username)) |
526 { | 526 { |
527 return user_name_completion (user, 0, NULL); | 527 return user_name_completion (partial_username, 0, NULL); |
528 } | 528 } |
529 | 529 |
530 DEFUN ("user-name-completion-1", Fuser_name_completion_1, 1, 1, 0, /* | 530 DEFUN ("user-name-completion-1", Fuser_name_completion_1, 1, 1, 0, /* |
531 Complete user name USER. | 531 Complete user name from PARTIAL-USERNAME. |
532 | 532 |
533 This function is identical to `user-name-completion', except that | 533 This function is identical to `user-name-completion', except that |
534 the cons of the completion and an indication of whether the | 534 the cons of the completion and an indication of whether the |
535 completion was unique is returned. | 535 completion was unique is returned. |
536 | 536 |
537 The car of the returned value is the longest string common to all | 537 The car of the returned value is the longest prefix common to all user |
538 user names that start with USER. If there is only one and USER | 538 names that start with PARTIAL-USERNAME. If there is only one and |
539 matches it exactly, the car is t. The car is nil if there is no | 539 PARTIAL-USERNAME matches it exactly, the car is t. The car is nil if |
540 user name starting with USER. The cdr of the result is non-nil | 540 there is no user name starting with PARTIAL-USERNAME. The cdr of the |
541 if and only if the completion returned in the car was unique. | 541 result is non-nil if and only if the completion returned in the car |
542 was unique. | |
542 */ | 543 */ |
543 (user)) | 544 (partial_username)) |
544 { | 545 { |
545 int uniq; | 546 int uniq; |
546 Lisp_Object completed = user_name_completion (user, 0, &uniq); | 547 Lisp_Object completed = user_name_completion (partial_username, 0, &uniq); |
547 return Fcons (completed, uniq ? Qt : Qnil); | 548 return Fcons (completed, uniq ? Qt : Qnil); |
548 } | 549 } |
549 | 550 |
550 DEFUN ("user-name-all-completions", Fuser_name_all_completions, 1, 1, 0, /* | 551 DEFUN ("user-name-all-completions", Fuser_name_all_completions, 1, 1, 0, /* |
551 Return a list of all completions of user name USER. | 552 Return a list of all user name completions from PARTIAL-USERNAME. |
552 These are all user names which begin with USER. | 553 These are all the user names which begin with PARTIAL-USERNAME. |
553 */ | 554 */ |
554 (user)) | 555 (partial_username)) |
555 { | 556 { |
556 return user_name_completion (user, 1, NULL); | 557 return user_name_completion (partial_username, 1, NULL); |
557 } | 558 } |
558 | 559 |
559 struct user_name | 560 struct user_name |
560 { | 561 { |
561 Bufbyte *ptr; | 562 Bufbyte *ptr; |