diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-11-16 00:52:35 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-11-16 00:52:35 +0000 |
commit | 8f55a47ccd69a6c1d6fa312067712e64c3812f1b (patch) | |
tree | 6d34ea8d968172d74ccd7012372b97dc39eef07a /src/fileio.c | |
parent | 1aa2839256f3cff54bf5b3fe57a154c3bd78b89c (diff) | |
download | emacs-8f55a47ccd69a6c1d6fa312067712e64c3812f1b.tar.gz |
(Fread_file_name_internal): Protect orig_string.
(Fsubstitute_in_file_name): Run a handler.
(Qsubstitute_in_file_name): New variable.
(syms_of_fileio): Set it up.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/fileio.c b/src/fileio.c index 317fd1b23e7..9772e4c5030 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -225,6 +225,7 @@ Lisp_Object Qinsert_file_contents; Lisp_Object Qwrite_region; Lisp_Object Qverify_visited_file_modtime; Lisp_Object Qset_visited_file_modtime; +Lisp_Object Qsubstitute_in_file_name; DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handler, 2, 2, 0, "Return FILENAME's handler function for OPERATION, if it has one.\n\ @@ -1555,9 +1556,16 @@ duplicates what `expand-file-name' does.") int total = 0; int substituted = 0; unsigned char *xnm; + Lisp_Object handler; CHECK_STRING (string, 0); + /* If the file name has special constructs in it, + call the corresponding file handler. */ + handler = Ffind_file_name_handler (string, Qsubstitute_in_file_name); + if (!NILP (handler)) + return call2 (handler, Qsubstitute_in_file_name, string); + nm = XSTRING (string)->data; #ifdef MSDOS dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); @@ -3935,7 +3943,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte { Lisp_Object name, specdir, realdir, val, orig_string; int changed; - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; realdir = dir; name = string; @@ -3943,7 +3951,7 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte specdir = Qnil; changed = 0; /* No need to protect ACTION--we only compare it with t and nil. */ - GCPRO4 (string, realdir, name, specdir); + GCPRO5 (string, realdir, name, specdir, orig_string); if (XSTRING (string)->size == 0) { @@ -4183,6 +4191,7 @@ syms_of_fileio () Qwrite_region = intern ("write-region"); Qverify_visited_file_modtime = intern ("verify-visited-file-modtime"); Qset_visited_file_modtime = intern ("set-visited-file-modtime"); + Qsubstitute_in_file_name = intern ("substitute-in-file-name"); staticpro (&Qexpand_file_name); staticpro (&Qdirectory_file_name); @@ -4210,6 +4219,7 @@ syms_of_fileio () staticpro (&Qinsert_file_contents); staticpro (&Qwrite_region); staticpro (&Qverify_visited_file_modtime); + staticpro (&Qsubstitute_in_file_name); Qfile_name_history = intern ("file-name-history"); Fset (Qfile_name_history, Qnil); |