summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-12-23 01:53:11 +0000
committerRichard M. Stallman <rms@gnu.org>1993-12-23 01:53:11 +0000
commitd9bc1c99c08860e101bc8c208e418165871f31d0 (patch)
tree5a02bfc2a5bb4371e8c5f60f201ef7777de8e7c5
parent7c6b2ea4a607449331f67b5d6dd302aedc7f3eff (diff)
downloademacs-d9bc1c99c08860e101bc8c208e418165871f31d0.tar.gz
(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.
-rw-r--r--src/fileio.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 09313252a3a..25860721709 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1885,9 +1885,11 @@ This happens for interactive use with M-x.")
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 @@ DIR defaults to current buffer's directory default.")
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);
}