aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c102
1 files changed, 53 insertions, 49 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 7e2d888b227..dcba6b6c0ae 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -88,64 +88,66 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
88#endif 88#endif
89 89
90/* Nonzero during writing of auto-save files */ 90/* Nonzero during writing of auto-save files */
91int auto_saving; 91static int auto_saving;
92 92
93/* Set by auto_save_1 to mode of original file so Fwrite_region will create 93/* Set by auto_save_1 to mode of original file so Fwrite_region will create
94 a new file with the same mode as the original */ 94 a new file with the same mode as the original */
95int auto_save_mode_bits; 95static int auto_save_mode_bits;
96 96
97/* Set by auto_save_1 if an error occurred during the last auto-save. */ 97/* Set by auto_save_1 if an error occurred during the last auto-save. */
98int auto_save_error_occurred; 98static int auto_save_error_occurred;
99 99
100/* The symbol bound to coding-system-for-read when 100/* The symbol bound to coding-system-for-read when
101 insert-file-contents is called for recovering a file. This is not 101 insert-file-contents is called for recovering a file. This is not
102 an actual coding system name, but just an indicator to tell 102 an actual coding system name, but just an indicator to tell
103 insert-file-contents to use `emacs-mule' with a special flag for 103 insert-file-contents to use `emacs-mule' with a special flag for
104 auto saving and recovering a file. */ 104 auto saving and recovering a file. */
105Lisp_Object Qauto_save_coding; 105static Lisp_Object Qauto_save_coding;
106 106
107/* Property name of a file name handler, 107/* Property name of a file name handler,
108 which gives a list of operations it handles.. */ 108 which gives a list of operations it handles.. */
109Lisp_Object Qoperations; 109static Lisp_Object Qoperations;
110 110
111/* Lisp functions for translating file formats */ 111/* Lisp functions for translating file formats */
112Lisp_Object Qformat_decode, Qformat_annotate_function; 112static Lisp_Object Qformat_decode, Qformat_annotate_function;
113 113
114/* Lisp function for setting buffer-file-coding-system and the 114/* Lisp function for setting buffer-file-coding-system and the
115 multibyteness of the current buffer after inserting a file. */ 115 multibyteness of the current buffer after inserting a file. */
116Lisp_Object Qafter_insert_file_set_coding; 116static Lisp_Object Qafter_insert_file_set_coding;
117 117
118Lisp_Object Qwrite_region_annotate_functions; 118static Lisp_Object Qwrite_region_annotate_functions;
119/* Each time an annotation function changes the buffer, the new buffer 119/* Each time an annotation function changes the buffer, the new buffer
120 is added here. */ 120 is added here. */
121Lisp_Object Vwrite_region_annotation_buffers; 121static Lisp_Object Vwrite_region_annotation_buffers;
122 122
123#ifdef HAVE_FSYNC 123#ifdef HAVE_FSYNC
124#endif 124#endif
125 125
126Lisp_Object Qdelete_by_moving_to_trash; 126static Lisp_Object Qdelete_by_moving_to_trash;
127 127
128/* Lisp function for moving files to trash. */ 128/* Lisp function for moving files to trash. */
129Lisp_Object Qmove_file_to_trash; 129static Lisp_Object Qmove_file_to_trash;
130 130
131/* Lisp function for recursively copying directories. */ 131/* Lisp function for recursively copying directories. */
132Lisp_Object Qcopy_directory; 132static Lisp_Object Qcopy_directory;
133 133
134/* Lisp function for recursively deleting directories. */ 134/* Lisp function for recursively deleting directories. */
135Lisp_Object Qdelete_directory; 135static Lisp_Object Qdelete_directory;
136 136
137#ifdef WINDOWSNT 137#ifdef WINDOWSNT
138#endif 138#endif
139 139
140Lisp_Object Qfile_error, Qfile_already_exists, Qfile_date_error; 140Lisp_Object Qfile_error;
141Lisp_Object Qexcl; 141static Lisp_Object Qfile_already_exists, Qfile_date_error;
142static Lisp_Object Qexcl;
142Lisp_Object Qfile_name_history; 143Lisp_Object Qfile_name_history;
143 144
144Lisp_Object Qcar_less_than_car; 145static Lisp_Object Qcar_less_than_car;
145 146
147static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object);
146static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT, 148static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT,
147 Lisp_Object *, struct coding_system *); 149 Lisp_Object *, struct coding_system *);
148static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT, 150static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT,
149 struct coding_system *); 151 struct coding_system *);
150 152
151 153
@@ -205,42 +207,43 @@ restore_point_unwind (Lisp_Object location)
205} 207}
206 208
207 209
208Lisp_Object Qexpand_file_name; 210static Lisp_Object Qexpand_file_name;
209Lisp_Object Qsubstitute_in_file_name; 211static Lisp_Object Qsubstitute_in_file_name;
210Lisp_Object Qdirectory_file_name; 212static Lisp_Object Qdirectory_file_name;
211Lisp_Object Qfile_name_directory; 213static Lisp_Object Qfile_name_directory;
212Lisp_Object Qfile_name_nondirectory; 214static Lisp_Object Qfile_name_nondirectory;
213Lisp_Object Qunhandled_file_name_directory; 215static Lisp_Object Qunhandled_file_name_directory;
214Lisp_Object Qfile_name_as_directory; 216static Lisp_Object Qfile_name_as_directory;
215Lisp_Object Qcopy_file; 217static Lisp_Object Qcopy_file;
216Lisp_Object Qmake_directory_internal; 218static Lisp_Object Qmake_directory_internal;
217Lisp_Object Qmake_directory; 219static Lisp_Object Qmake_directory;
218Lisp_Object Qdelete_directory_internal; 220static Lisp_Object Qdelete_directory_internal;
219Lisp_Object Qdelete_file; 221Lisp_Object Qdelete_file;
220Lisp_Object Qrename_file; 222static Lisp_Object Qrename_file;
221Lisp_Object Qadd_name_to_file; 223static Lisp_Object Qadd_name_to_file;
222Lisp_Object Qmake_symbolic_link; 224static Lisp_Object Qmake_symbolic_link;
223Lisp_Object Qfile_exists_p; 225Lisp_Object Qfile_exists_p;
224Lisp_Object Qfile_executable_p; 226static Lisp_Object Qfile_executable_p;
225Lisp_Object Qfile_readable_p; 227static Lisp_Object Qfile_readable_p;
226Lisp_Object Qfile_writable_p; 228static Lisp_Object Qfile_writable_p;
227Lisp_Object Qfile_symlink_p; 229static Lisp_Object Qfile_symlink_p;
228Lisp_Object Qaccess_file; 230static Lisp_Object Qaccess_file;
229Lisp_Object Qfile_directory_p; 231Lisp_Object Qfile_directory_p;
230Lisp_Object Qfile_regular_p; 232static Lisp_Object Qfile_regular_p;
231Lisp_Object Qfile_accessible_directory_p; 233static Lisp_Object Qfile_accessible_directory_p;
232Lisp_Object Qfile_modes; 234static Lisp_Object Qfile_modes;
233Lisp_Object Qset_file_modes; 235static Lisp_Object Qset_file_modes;
234Lisp_Object Qset_file_times; 236static Lisp_Object Qset_file_times;
235Lisp_Object Qfile_selinux_context; 237static Lisp_Object Qfile_selinux_context;
236Lisp_Object Qset_file_selinux_context; 238static Lisp_Object Qset_file_selinux_context;
237Lisp_Object Qfile_newer_than_file_p; 239static Lisp_Object Qfile_newer_than_file_p;
238Lisp_Object Qinsert_file_contents; 240Lisp_Object Qinsert_file_contents;
239Lisp_Object Qwrite_region; 241Lisp_Object Qwrite_region;
240Lisp_Object Qverify_visited_file_modtime; 242static Lisp_Object Qverify_visited_file_modtime;
241Lisp_Object Qset_visited_file_modtime; 243static Lisp_Object Qset_visited_file_modtime;
242 244
243DEFUN ("find-file-name-handler", Ffind_file_name_handler, Sfind_file_name_handler, 2, 2, 0, 245DEFUN ("find-file-name-handler", Ffind_file_name_handler,
246 Sfind_file_name_handler, 2, 2, 0,
244 doc: /* Return FILENAME's handler function for OPERATION, if it has one. 247 doc: /* Return FILENAME's handler function for OPERATION, if it has one.
245Otherwise, return nil. 248Otherwise, return nil.
246A file name is handled if one of the regular expressions in 249A file name is handled if one of the regular expressions in
@@ -2633,7 +2636,8 @@ See `file-symlink-p' to distinguish symlinks. */)
2633 return S_ISDIR (st.st_mode) ? Qt : Qnil; 2636 return S_ISDIR (st.st_mode) ? Qt : Qnil;
2634} 2637}
2635 2638
2636DEFUN ("file-accessible-directory-p", Ffile_accessible_directory_p, Sfile_accessible_directory_p, 1, 1, 0, 2639DEFUN ("file-accessible-directory-p", Ffile_accessible_directory_p,
2640 Sfile_accessible_directory_p, 1, 1, 0,
2637 doc: /* Return t if file FILENAME names a directory you can open. 2641 doc: /* Return t if file FILENAME names a directory you can open.
2638For the value to be t, FILENAME must specify the name of a directory as a file, 2642For the value to be t, FILENAME must specify the name of a directory as a file,
2639and the directory must allow you to open files in it. In order to use a 2643and the directory must allow you to open files in it. In order to use a
@@ -3800,7 +3804,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3800 /* For a special file, all we can do is guess. */ 3804 /* For a special file, all we can do is guess. */
3801 total = READ_BUF_SIZE; 3805 total = READ_BUF_SIZE;
3802 3806
3803 if (NILP (visit) && inserted > 0) 3807 if (NILP (visit) && total > 0)
3804 { 3808 {
3805#ifdef CLASH_DETECTION 3809#ifdef CLASH_DETECTION
3806 if (!NILP (BVAR (current_buffer, file_truename)) 3810 if (!NILP (BVAR (current_buffer, file_truename))