diff 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
line wrap: on
line diff
--- a/src/fileio.c	Thu Dec 23 01:43:11 1993 +0000
+++ b/src/fileio.c	Thu Dec 23 01:53:11 1993 +0000
@@ -1885,9 +1885,11 @@
   GCPRO2 (filename, linkname);
   CHECK_STRING (filename, 0);
   CHECK_STRING (linkname, 1);
-#if 0 /* This made it impossible to make a link to a relative name.  */
-  filename = Fexpand_file_name (filename, Qnil);
-#endif
+  /* If the link target has a ~, we must expand it to get
+     a truly valid file name.  Otherwise, do not expand;
+     we want to permit links to relative file names.  */
+  if (XSTRING (filename)->data[0] == '~')
+    filename = Fexpand_file_name (filename, Qnil);
   linkname = Fexpand_file_name (linkname, Qnil);
 
   /* If the file name has special constructs in it,
@@ -3431,7 +3433,12 @@
   if (!NILP (tem) && !NILP (defalt))
     return defalt;
   if (XSTRING (val)->size == 0 && NILP (insdef))
-    return defalt;
+    {
+      if (!NILP (defalt))
+	return defalt;
+      else
+	error ("No default file name");
+    }
   return Fsubstitute_in_file_name (val);
 }