diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-11-14 23:58:19 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-11-14 23:58:19 +0000 |
commit | 27ac9fd0b42f0762f067fe5c261ca71da0b83d16 (patch) | |
tree | 03f2ffdad4247a0e3137334706e7f724202a88ba /src/fileio.c | |
parent | fffb976dbbaa182d70702ae53373b95cec7f8939 (diff) | |
download | emacs-27ac9fd0b42f0762f067fe5c261ca71da0b83d16.tar.gz |
(Finsert_file_contents): If VISIT, set the buffer components
such as the filename even before signaling error for non-regular file.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c index d33cc57c2bb..a5028dd7896 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2725,6 +2725,7 @@ and (2) it puts less data in the undo list.") Lisp_Object handler, val, insval; Lisp_Object p; int total; + int not_regular; val = Qnil; p = Qnil; @@ -2764,14 +2765,21 @@ and (2) it puts less data in the undo list.") goto notfound; } + not_regular = 0; #ifdef S_IFREG /* This code will need to be changed in order to work on named pipes, and it's probably just not worth it. So we should at least signal an error. */ if (!S_ISREG (st.st_mode)) - Fsignal (Qfile_error, - Fcons (build_string ("not a regular file"), - Fcons (filename, Qnil))); + { + if (NILP (visit)) + Fsignal (Qfile_error, + Fcons (build_string ("not a regular file"), + Fcons (filename, Qnil))); + + not_regular = 1; + goto notfound; + } #endif if (fd < 0) @@ -3036,6 +3044,11 @@ and (2) it puts less data in the undo list.") unlock_file (filename); } #endif /* CLASH_DETECTION */ + if (not_regular) + Fsignal (Qfile_error, + Fcons (build_string ("not a regular file"), + Fcons (filename, Qnil))); + /* If visiting nonexistent file, return nil. */ if (current_buffer->modtime == -1) report_file_error ("Opening input file", Fcons (filename, Qnil)); |