diff options
| author | Richard M. Stallman | 1994-11-14 23:58:19 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-11-14 23:58:19 +0000 |
| commit | 330bfe57d6fff4b1c3cd4d920e84924248b21a88 (patch) | |
| tree | 4e6ce0f130fa8c05b2d3b3b6f7d1ed1f0a6d6abe /src | |
| parent | e0271583d2a733712b466970f6592631bc557636 (diff) | |
| download | emacs-330bfe57d6fff4b1c3cd4d920e84924248b21a88.tar.gz emacs-330bfe57d6fff4b1c3cd4d920e84924248b21a88.zip | |
(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')
| -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.") | |||
| 2725 | Lisp_Object handler, val, insval; | 2725 | Lisp_Object handler, val, insval; |
| 2726 | Lisp_Object p; | 2726 | Lisp_Object p; |
| 2727 | int total; | 2727 | int total; |
| 2728 | int not_regular; | ||
| 2728 | 2729 | ||
| 2729 | val = Qnil; | 2730 | val = Qnil; |
| 2730 | p = Qnil; | 2731 | p = Qnil; |
| @@ -2764,14 +2765,21 @@ and (2) it puts less data in the undo list.") | |||
| 2764 | goto notfound; | 2765 | goto notfound; |
| 2765 | } | 2766 | } |
| 2766 | 2767 | ||
| 2768 | not_regular = 0; | ||
| 2767 | #ifdef S_IFREG | 2769 | #ifdef S_IFREG |
| 2768 | /* This code will need to be changed in order to work on named | 2770 | /* This code will need to be changed in order to work on named |
| 2769 | pipes, and it's probably just not worth it. So we should at | 2771 | pipes, and it's probably just not worth it. So we should at |
| 2770 | least signal an error. */ | 2772 | least signal an error. */ |
| 2771 | if (!S_ISREG (st.st_mode)) | 2773 | if (!S_ISREG (st.st_mode)) |
| 2772 | Fsignal (Qfile_error, | 2774 | { |
| 2773 | Fcons (build_string ("not a regular file"), | 2775 | if (NILP (visit)) |
| 2774 | Fcons (filename, Qnil))); | 2776 | Fsignal (Qfile_error, |
| 2777 | Fcons (build_string ("not a regular file"), | ||
| 2778 | Fcons (filename, Qnil))); | ||
| 2779 | |||
| 2780 | not_regular = 1; | ||
| 2781 | goto notfound; | ||
| 2782 | } | ||
| 2775 | #endif | 2783 | #endif |
| 2776 | 2784 | ||
| 2777 | if (fd < 0) | 2785 | if (fd < 0) |
| @@ -3036,6 +3044,11 @@ and (2) it puts less data in the undo list.") | |||
| 3036 | unlock_file (filename); | 3044 | unlock_file (filename); |
| 3037 | } | 3045 | } |
| 3038 | #endif /* CLASH_DETECTION */ | 3046 | #endif /* CLASH_DETECTION */ |
| 3047 | if (not_regular) | ||
| 3048 | Fsignal (Qfile_error, | ||
| 3049 | Fcons (build_string ("not a regular file"), | ||
| 3050 | Fcons (filename, Qnil))); | ||
| 3051 | |||
| 3039 | /* If visiting nonexistent file, return nil. */ | 3052 | /* If visiting nonexistent file, return nil. */ |
| 3040 | if (current_buffer->modtime == -1) | 3053 | if (current_buffer->modtime == -1) |
| 3041 | report_file_error ("Opening input file", Fcons (filename, Qnil)); | 3054 | report_file_error ("Opening input file", Fcons (filename, Qnil)); |