# HG changeset patch # User Richard M. Stallman # Date 784857499 0 # Node ID ec185bc6607191577b7ff27a39e37975f246ed32 # Parent 486fd2f809f52f4eb74211ff37be4234980bfee9 (Finsert_file_contents): If VISIT, set the buffer components such as the filename even before signaling error for non-regular file. diff -r 486fd2f809f5 -r ec185bc66071 src/fileio.c --- a/src/fileio.c Mon Nov 14 23:28:44 1994 +0000 +++ b/src/fileio.c Mon Nov 14 23:58:19 1994 +0000 @@ -2725,6 +2725,7 @@ Lisp_Object handler, val, insval; Lisp_Object p; int total; + int not_regular; val = Qnil; p = Qnil; @@ -2764,14 +2765,21 @@ 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 @@ 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));