Mercurial > emacs
comparison src/fileio.c @ 5245:4a9b93b0eac3
(Fmake_symbolic_link): Do expand FILENAME if starts with ~.
(Fread_file_name): If defalt is nil and user tries to use it, signal an error.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 23 Dec 1993 01:53:11 +0000 |
parents | d48d18e20316 |
children | 8e1536744d7e |
comparison
equal
deleted
inserted
replaced
5244:c0bd54986550 | 5245:4a9b93b0eac3 |
---|---|
1883 struct gcpro gcpro1, gcpro2; | 1883 struct gcpro gcpro1, gcpro2; |
1884 | 1884 |
1885 GCPRO2 (filename, linkname); | 1885 GCPRO2 (filename, linkname); |
1886 CHECK_STRING (filename, 0); | 1886 CHECK_STRING (filename, 0); |
1887 CHECK_STRING (linkname, 1); | 1887 CHECK_STRING (linkname, 1); |
1888 #if 0 /* This made it impossible to make a link to a relative name. */ | 1888 /* If the link target has a ~, we must expand it to get |
1889 filename = Fexpand_file_name (filename, Qnil); | 1889 a truly valid file name. Otherwise, do not expand; |
1890 #endif | 1890 we want to permit links to relative file names. */ |
1891 if (XSTRING (filename)->data[0] == '~') | |
1892 filename = Fexpand_file_name (filename, Qnil); | |
1891 linkname = Fexpand_file_name (linkname, Qnil); | 1893 linkname = Fexpand_file_name (linkname, Qnil); |
1892 | 1894 |
1893 /* If the file name has special constructs in it, | 1895 /* If the file name has special constructs in it, |
1894 call the corresponding file handler. */ | 1896 call the corresponding file handler. */ |
1895 handler = Ffind_file_name_handler (filename); | 1897 handler = Ffind_file_name_handler (filename); |
3429 error ("No file name specified"); | 3431 error ("No file name specified"); |
3430 tem = Fstring_equal (val, insdef); | 3432 tem = Fstring_equal (val, insdef); |
3431 if (!NILP (tem) && !NILP (defalt)) | 3433 if (!NILP (tem) && !NILP (defalt)) |
3432 return defalt; | 3434 return defalt; |
3433 if (XSTRING (val)->size == 0 && NILP (insdef)) | 3435 if (XSTRING (val)->size == 0 && NILP (insdef)) |
3434 return defalt; | 3436 { |
3437 if (!NILP (defalt)) | |
3438 return defalt; | |
3439 else | |
3440 error ("No default file name"); | |
3441 } | |
3435 return Fsubstitute_in_file_name (val); | 3442 return Fsubstitute_in_file_name (val); |
3436 } | 3443 } |
3437 | 3444 |
3438 #if 0 /* Old version */ | 3445 #if 0 /* Old version */ |
3439 DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 5, 0, | 3446 DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 5, 0, |