aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-09-12 08:53:08 +0000
committerRichard M. Stallman1992-09-12 08:53:08 +0000
commit0bf2eed2feb198bff690dd1a8301179acb6d6fcd (patch)
treedc70a9b03f1179cb878433cf98f9bf4f5e0c0c1f
parent51172b6d06f14a2f724418357dcc096537d69a5f (diff)
downloademacs-0bf2eed2feb198bff690dd1a8301179acb6d6fcd.tar.gz
emacs-0bf2eed2feb198bff690dd1a8301179acb6d6fcd.zip
(Ffile_name_directory, Ffile_name_nondirectory):
(Ffile_name_as_directory, Fdirectory_file_name, Fexpand_file_name): Call find_file_handler. (syms_of_fileio): Set up Qfile_name_directory, etc. (Fcopy_file): Call find_file_handler for newname as well as for filename.
-rw-r--r--src/fileio.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 9cc7e9e72b7..9c24a7caf38 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -130,6 +130,11 @@ close_file_unwind (fd)
130 close (XFASTINT (fd)); 130 close (XFASTINT (fd));
131} 131}
132 132
133Lisp_Object Qexpand_file_name;
134Lisp_Object Qdirectory_file_name;
135Lisp_Object Qfile_name_directory;
136Lisp_Object Qfile_name_nondirectory;
137Lisp_Object Qfile_name_as_directory;
133Lisp_Object Qcopy_file; 138Lisp_Object Qcopy_file;
134Lisp_Object Qmake_directory; 139Lisp_Object Qmake_directory;
135Lisp_Object Qdelete_directory; 140Lisp_Object Qdelete_directory;
@@ -188,9 +193,16 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.")
188{ 193{
189 register unsigned char *beg; 194 register unsigned char *beg;
190 register unsigned char *p; 195 register unsigned char *p;
196 Lisp_Object handler;
191 197
192 CHECK_STRING (file, 0); 198 CHECK_STRING (file, 0);
193 199
200 /* If the file name has special constructs in it,
201 call the corresponding file handler. */
202 handler = find_file_handler (file);
203 if (!NILP (handler))
204 return call2 (handler, Qfile_name_directory, file);
205
194 beg = XSTRING (file)->data; 206 beg = XSTRING (file)->data;
195 p = beg + XSTRING (file)->size; 207 p = beg + XSTRING (file)->size;
196 208
@@ -215,9 +227,16 @@ or the entire name if it contains no slash.")
215 Lisp_Object file; 227 Lisp_Object file;
216{ 228{
217 register unsigned char *beg, *p, *end; 229 register unsigned char *beg, *p, *end;
230 Lisp_Object handler;
218 231
219 CHECK_STRING (file, 0); 232 CHECK_STRING (file, 0);
220 233
234 /* If the file name has special constructs in it,
235 call the corresponding file handler. */
236 handler = find_file_handler (file);
237 if (!NILP (handler))
238 return call2 (handler, Qfile_name_nondirectory, file);
239
221 beg = XSTRING (file)->data; 240 beg = XSTRING (file)->data;
222 end = p = beg + XSTRING (file)->size; 241 end = p = beg + XSTRING (file)->size;
223 242
@@ -316,10 +335,18 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc.")
316 Lisp_Object file; 335 Lisp_Object file;
317{ 336{
318 char *buf; 337 char *buf;
338 Lisp_Object handler;
319 339
320 CHECK_STRING (file, 0); 340 CHECK_STRING (file, 0);
321 if (NILP (file)) 341 if (NILP (file))
322 return Qnil; 342 return Qnil;
343
344 /* If the file name has special constructs in it,
345 call the corresponding file handler. */
346 handler = find_file_handler (file);
347 if (!NILP (handler))
348 return call2 (handler, Qfile_name_as_directory, file);
349
323 buf = (char *) alloca (XSTRING (file)->size + 10); 350 buf = (char *) alloca (XSTRING (file)->size + 10);
324 return build_string (file_name_as_directory (buf, XSTRING (file)->data)); 351 return build_string (file_name_as_directory (buf, XSTRING (file)->data));
325} 352}
@@ -481,11 +508,19 @@ it returns a file name such as \"[X]Y.DIR.1\".")
481 Lisp_Object directory; 508 Lisp_Object directory;
482{ 509{
483 char *buf; 510 char *buf;
511 Lisp_Object handler;
484 512
485 CHECK_STRING (directory, 0); 513 CHECK_STRING (directory, 0);
486 514
487 if (NILP (directory)) 515 if (NILP (directory))
488 return Qnil; 516 return Qnil;
517
518 /* If the file name has special constructs in it,
519 call the corresponding file handler. */
520 handler = find_file_handler (directory);
521 if (!NILP (handler))
522 return call2 (handler, Qdirectory_file_name, directory);
523
489#ifdef VMS 524#ifdef VMS
490 /* 20 extra chars is insufficient for VMS, since we might perform a 525 /* 20 extra chars is insufficient for VMS, since we might perform a
491 logical name translation. an equivalence string can be up to 255 526 logical name translation. an equivalence string can be up to 255
@@ -541,9 +576,16 @@ See also the function `substitute-in-file-name'.")
541 int lbrack = 0, rbrack = 0; 576 int lbrack = 0, rbrack = 0;
542 int dots = 0; 577 int dots = 0;
543#endif /* VMS */ 578#endif /* VMS */
579 Lisp_Object handler;
544 580
545 CHECK_STRING (name, 0); 581 CHECK_STRING (name, 0);
546 582
583 /* If the file name has special constructs in it,
584 call the corresponding file handler. */
585 handler = find_file_handler (name);
586 if (!NILP (handler))
587 return call2 (handler, Qexpand_file_name, name);
588
547#ifdef VMS 589#ifdef VMS
548 /* Filenames on VMS are always upper case. */ 590 /* Filenames on VMS are always upper case. */
549 name = Fupcase (name); 591 name = Fupcase (name);
@@ -1452,11 +1494,15 @@ A prefix arg makes KEEP-TIME non-nil.")
1452 filename = Fexpand_file_name (filename, Qnil); 1494 filename = Fexpand_file_name (filename, Qnil);
1453 newname = Fexpand_file_name (newname, Qnil); 1495 newname = Fexpand_file_name (newname, Qnil);
1454 1496
1455 /* If the file name has special constructs in it, 1497 /* If the input file name has special constructs in it,
1456 call the corresponding file handler. */ 1498 call the corresponding file handler. */
1457 handler = find_file_handler (filename); 1499 handler = find_file_handler (filename);
1458 if (!NILP (handler)) 1500 if (!NILP (handler))
1459 return call3 (handler, Qcopy_file, filename, newname); 1501 return call3 (handler, Qcopy_file, filename, newname);
1502 /* Likewise for output file name. */
1503 handler = find_file_handler (newname);
1504 if (!NILP (handler))
1505 return call3 (handler, Qcopy_file, filename, newname);
1460 1506
1461 if (NILP (ok_if_already_exists) 1507 if (NILP (ok_if_already_exists)
1462 || XTYPE (ok_if_already_exists) == Lisp_Int) 1508 || XTYPE (ok_if_already_exists) == Lisp_Int)
@@ -3075,6 +3121,11 @@ DIR defaults to current buffer's directory default.")
3075 3121
3076syms_of_fileio () 3122syms_of_fileio ()
3077{ 3123{
3124 Qexpand_file_name = intern ("expand-file-name");
3125 Qdirectory_file_name = intern ("directory-file-name");
3126 Qfile_name_directory = intern ("file-name-directory");
3127 Qfile_name_nondirectory = intern ("file-name-nondirectory");
3128 Qfile_name_as_directory = intern ("file-name-as-directory");
3078 Qcopy_file = intern ("copy-file"); 3129 Qcopy_file = intern ("copy-file");
3079 Qmake_directory = intern ("make-directory"); 3130 Qmake_directory = intern ("make-directory");
3080 Qdelete_directory = intern ("delete-directory"); 3131 Qdelete_directory = intern ("delete-directory");