comparison src/fileio.c @ 10719:40ae63b409f4

(Fexpand_file_name): Look for a handler for defalt. (syms_of_fileio): Minor rearrangement.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 Feb 1995 04:29:53 +0000
parents 6368f8d9bf07
children 634120aac320
comparison
equal deleted inserted replaced
10718:b4bfe218c4ca 10719:40ae63b409f4
197 SET_PT (marker_position (location)); 197 SET_PT (marker_position (location));
198 Fset_marker (location, Qnil, Qnil); 198 Fset_marker (location, Qnil, Qnil);
199 } 199 }
200 200
201 Lisp_Object Qexpand_file_name; 201 Lisp_Object Qexpand_file_name;
202 Lisp_Object Qsubstitute_in_file_name;
202 Lisp_Object Qdirectory_file_name; 203 Lisp_Object Qdirectory_file_name;
203 Lisp_Object Qfile_name_directory; 204 Lisp_Object Qfile_name_directory;
204 Lisp_Object Qfile_name_nondirectory; 205 Lisp_Object Qfile_name_nondirectory;
205 Lisp_Object Qunhandled_file_name_directory; 206 Lisp_Object Qunhandled_file_name_directory;
206 Lisp_Object Qfile_name_as_directory; 207 Lisp_Object Qfile_name_as_directory;
223 Lisp_Object Qfile_newer_than_file_p; 224 Lisp_Object Qfile_newer_than_file_p;
224 Lisp_Object Qinsert_file_contents; 225 Lisp_Object Qinsert_file_contents;
225 Lisp_Object Qwrite_region; 226 Lisp_Object Qwrite_region;
226 Lisp_Object Qverify_visited_file_modtime; 227 Lisp_Object Qverify_visited_file_modtime;
227 Lisp_Object Qset_visited_file_modtime; 228 Lisp_Object Qset_visited_file_modtime;
228 Lisp_Object Qsubstitute_in_file_name;
229 229
230 DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handler, 2, 2, 0, 230 DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handler, 2, 2, 0,
231 "Return FILENAME's handler function for OPERATION, if it has one.\n\ 231 "Return FILENAME's handler function for OPERATION, if it has one.\n\
232 Otherwise, return nil.\n\ 232 Otherwise, return nil.\n\
233 A file name is handled if one of the regular expressions in\n\ 233 A file name is handled if one of the regular expressions in\n\
743 /* If the file name has special constructs in it, 743 /* If the file name has special constructs in it,
744 call the corresponding file handler. */ 744 call the corresponding file handler. */
745 handler = Ffind_file_name_handler (name, Qexpand_file_name); 745 handler = Ffind_file_name_handler (name, Qexpand_file_name);
746 if (!NILP (handler)) 746 if (!NILP (handler))
747 return call3 (handler, Qexpand_file_name, name, defalt); 747 return call3 (handler, Qexpand_file_name, name, defalt);
748 if (!NILP (defalt))
749 {
750 handler = Ffind_file_name_handler (defalt, Qexpand_file_name);
751 if (!NILP (handler))
752 return call3 (handler, Qexpand_file_name, name, defalt);
753 }
748 754
749 /* Use the buffer's default-directory if DEFALT is omitted. */ 755 /* Use the buffer's default-directory if DEFALT is omitted. */
750 if (NILP (defalt)) 756 if (NILP (defalt))
751 defalt = current_buffer->directory; 757 defalt = current_buffer->directory;
752 CHECK_STRING (defalt, 1); 758 CHECK_STRING (defalt, 1);
4181 #endif /* Old version */ 4187 #endif /* Old version */
4182 4188
4183 syms_of_fileio () 4189 syms_of_fileio ()
4184 { 4190 {
4185 Qexpand_file_name = intern ("expand-file-name"); 4191 Qexpand_file_name = intern ("expand-file-name");
4192 Qsubstitute_in_file_name = intern ("substitute-in-file-name");
4186 Qdirectory_file_name = intern ("directory-file-name"); 4193 Qdirectory_file_name = intern ("directory-file-name");
4187 Qfile_name_directory = intern ("file-name-directory"); 4194 Qfile_name_directory = intern ("file-name-directory");
4188 Qfile_name_nondirectory = intern ("file-name-nondirectory"); 4195 Qfile_name_nondirectory = intern ("file-name-nondirectory");
4189 Qunhandled_file_name_directory = intern ("unhandled-file-name-directory"); 4196 Qunhandled_file_name_directory = intern ("unhandled-file-name-directory");
4190 Qfile_name_as_directory = intern ("file-name-as-directory"); 4197 Qfile_name_as_directory = intern ("file-name-as-directory");
4207 Qfile_newer_than_file_p = intern ("file-newer-than-file-p"); 4214 Qfile_newer_than_file_p = intern ("file-newer-than-file-p");
4208 Qinsert_file_contents = intern ("insert-file-contents"); 4215 Qinsert_file_contents = intern ("insert-file-contents");
4209 Qwrite_region = intern ("write-region"); 4216 Qwrite_region = intern ("write-region");
4210 Qverify_visited_file_modtime = intern ("verify-visited-file-modtime"); 4217 Qverify_visited_file_modtime = intern ("verify-visited-file-modtime");
4211 Qset_visited_file_modtime = intern ("set-visited-file-modtime"); 4218 Qset_visited_file_modtime = intern ("set-visited-file-modtime");
4212 Qsubstitute_in_file_name = intern ("substitute-in-file-name");
4213 4219
4214 staticpro (&Qexpand_file_name); 4220 staticpro (&Qexpand_file_name);
4221 staticpro (&Qsubstitute_in_file_name);
4215 staticpro (&Qdirectory_file_name); 4222 staticpro (&Qdirectory_file_name);
4216 staticpro (&Qfile_name_directory); 4223 staticpro (&Qfile_name_directory);
4217 staticpro (&Qfile_name_nondirectory); 4224 staticpro (&Qfile_name_nondirectory);
4218 staticpro (&Qunhandled_file_name_directory); 4225 staticpro (&Qunhandled_file_name_directory);
4219 staticpro (&Qfile_name_as_directory); 4226 staticpro (&Qfile_name_as_directory);
4235 staticpro (&Qset_file_modes); 4242 staticpro (&Qset_file_modes);
4236 staticpro (&Qfile_newer_than_file_p); 4243 staticpro (&Qfile_newer_than_file_p);
4237 staticpro (&Qinsert_file_contents); 4244 staticpro (&Qinsert_file_contents);
4238 staticpro (&Qwrite_region); 4245 staticpro (&Qwrite_region);
4239 staticpro (&Qverify_visited_file_modtime); 4246 staticpro (&Qverify_visited_file_modtime);
4240 staticpro (&Qsubstitute_in_file_name);
4241 4247
4242 Qfile_name_history = intern ("file-name-history"); 4248 Qfile_name_history = intern ("file-name-history");
4243 Fset (Qfile_name_history, Qnil); 4249 Fset (Qfile_name_history, Qnil);
4244 staticpro (&Qfile_name_history); 4250 staticpro (&Qfile_name_history);
4245 4251