aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c107
1 files changed, 25 insertions, 82 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 39514ee18e6..15c6f9123a2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,6 +1,6 @@
1/* File IO for GNU Emacs. 1/* File IO for GNU Emacs.
2 2
3Copyright (C) 1985-1988, 1993-2014 Free Software Foundation, Inc. 3Copyright (C) 1985-1988, 1993-2015 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -113,50 +113,10 @@ static bool auto_save_error_occurred;
113static bool valid_timestamp_file_system; 113static bool valid_timestamp_file_system;
114static dev_t timestamp_file_system; 114static dev_t timestamp_file_system;
115 115
116/* The symbol bound to coding-system-for-read when
117 insert-file-contents is called for recovering a file. This is not
118 an actual coding system name, but just an indicator to tell
119 insert-file-contents to use `emacs-mule' with a special flag for
120 auto saving and recovering a file. */
121static Lisp_Object Qauto_save_coding;
122
123/* Property name of a file name handler,
124 which gives a list of operations it handles.. */
125static Lisp_Object Qoperations;
126
127/* Lisp functions for translating file formats. */
128static Lisp_Object Qformat_decode, Qformat_annotate_function;
129
130/* Lisp function for setting buffer-file-coding-system and the
131 multibyteness of the current buffer after inserting a file. */
132static Lisp_Object Qafter_insert_file_set_coding;
133
134static Lisp_Object Qwrite_region_annotate_functions;
135/* Each time an annotation function changes the buffer, the new buffer 116/* Each time an annotation function changes the buffer, the new buffer
136 is added here. */ 117 is added here. */
137static Lisp_Object Vwrite_region_annotation_buffers; 118static Lisp_Object Vwrite_region_annotation_buffers;
138 119
139static Lisp_Object Qdelete_by_moving_to_trash;
140
141/* Lisp function for moving files to trash. */
142static Lisp_Object Qmove_file_to_trash;
143
144/* Lisp function for recursively copying directories. */
145static Lisp_Object Qcopy_directory;
146
147/* Lisp function for recursively deleting directories. */
148static Lisp_Object Qdelete_directory;
149
150static Lisp_Object Qsubstitute_env_in_file_name;
151static Lisp_Object Qget_buffer_window_list;
152
153Lisp_Object Qfile_error, Qfile_notify_error;
154static Lisp_Object Qfile_already_exists, Qfile_date_error;
155static Lisp_Object Qexcl;
156Lisp_Object Qfile_name_history;
157
158static Lisp_Object Qcar_less_than_car;
159
160static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, 120static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
161 Lisp_Object *, struct coding_system *); 121 Lisp_Object *, struct coding_system *);
162static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, 122static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
@@ -291,43 +251,6 @@ restore_point_unwind (Lisp_Object location)
291} 251}
292 252
293 253
294static Lisp_Object Qexpand_file_name;
295static Lisp_Object Qsubstitute_in_file_name;
296static Lisp_Object Qdirectory_file_name;
297static Lisp_Object Qfile_name_directory;
298static Lisp_Object Qfile_name_nondirectory;
299static Lisp_Object Qunhandled_file_name_directory;
300static Lisp_Object Qfile_name_as_directory;
301static Lisp_Object Qcopy_file;
302static Lisp_Object Qmake_directory_internal;
303static Lisp_Object Qmake_directory;
304static Lisp_Object Qdelete_directory_internal;
305Lisp_Object Qdelete_file;
306static Lisp_Object Qrename_file;
307static Lisp_Object Qadd_name_to_file;
308static Lisp_Object Qmake_symbolic_link;
309Lisp_Object Qfile_exists_p;
310static Lisp_Object Qfile_executable_p;
311static Lisp_Object Qfile_readable_p;
312static Lisp_Object Qfile_writable_p;
313static Lisp_Object Qfile_symlink_p;
314static Lisp_Object Qaccess_file;
315Lisp_Object Qfile_directory_p;
316static Lisp_Object Qfile_regular_p;
317static Lisp_Object Qfile_accessible_directory_p;
318static Lisp_Object Qfile_modes;
319static Lisp_Object Qset_file_modes;
320static Lisp_Object Qset_file_times;
321static Lisp_Object Qfile_selinux_context;
322static Lisp_Object Qset_file_selinux_context;
323static Lisp_Object Qfile_acl;
324static Lisp_Object Qset_file_acl;
325static Lisp_Object Qfile_newer_than_file_p;
326Lisp_Object Qinsert_file_contents;
327Lisp_Object Qwrite_region;
328static Lisp_Object Qverify_visited_file_modtime;
329static Lisp_Object Qset_visited_file_modtime;
330
331DEFUN ("find-file-name-handler", Ffind_file_name_handler, 254DEFUN ("find-file-name-handler", Ffind_file_name_handler,
332 Sfind_file_name_handler, 2, 2, 0, 255 Sfind_file_name_handler, 2, 2, 0,
333 doc: /* Return FILENAME's handler function for OPERATION, if it has one. 256 doc: /* Return FILENAME's handler function for OPERATION, if it has one.
@@ -4741,8 +4664,8 @@ Optional fifth argument VISIT, if t or a string, means
4741If VISIT is a string, it is a second file name; 4664If VISIT is a string, it is a second file name;
4742 the output goes to FILENAME, but the buffer is marked as visiting VISIT. 4665 the output goes to FILENAME, but the buffer is marked as visiting VISIT.
4743 VISIT is also the file name to lock and unlock for clash detection. 4666 VISIT is also the file name to lock and unlock for clash detection.
4744If VISIT is neither t nor nil nor a string, 4667If VISIT is neither t nor nil nor a string, or if Emacs is in batch mode,
4745 that means do not display the \"Wrote file\" message. 4668 do not display the \"Wrote file\" message.
4746The optional sixth arg LOCKNAME, if non-nil, specifies the name to 4669The optional sixth arg LOCKNAME, if non-nil, specifies the name to
4747 use for locking and unlocking, overriding FILENAME and VISIT. 4670 use for locking and unlocking, overriding FILENAME and VISIT.
4748The optional seventh arg MUSTBENEW, if non-nil, insists on a check 4671The optional seventh arg MUSTBENEW, if non-nil, insists on a check
@@ -5109,7 +5032,7 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,
5109 return Qnil; 5032 return Qnil;
5110 } 5033 }
5111 5034
5112 if (!auto_saving) 5035 if (!auto_saving && !noninteractive)
5113 message_with_string ((NUMBERP (append) 5036 message_with_string ((NUMBERP (append)
5114 ? "Updated %s" 5037 ? "Updated %s"
5115 : ! NILP (append) 5038 : ! NILP (append)
@@ -5866,7 +5789,10 @@ init_fileio (void)
5866void 5789void
5867syms_of_fileio (void) 5790syms_of_fileio (void)
5868{ 5791{
5792 /* Property name of a file name handler,
5793 which gives a list of operations it handles. */
5869 DEFSYM (Qoperations, "operations"); 5794 DEFSYM (Qoperations, "operations");
5795
5870 DEFSYM (Qexpand_file_name, "expand-file-name"); 5796 DEFSYM (Qexpand_file_name, "expand-file-name");
5871 DEFSYM (Qsubstitute_in_file_name, "substitute-in-file-name"); 5797 DEFSYM (Qsubstitute_in_file_name, "substitute-in-file-name");
5872 DEFSYM (Qdirectory_file_name, "directory-file-name"); 5798 DEFSYM (Qdirectory_file_name, "directory-file-name");
@@ -5903,6 +5829,12 @@ syms_of_fileio (void)
5903 DEFSYM (Qwrite_region, "write-region"); 5829 DEFSYM (Qwrite_region, "write-region");
5904 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime"); 5830 DEFSYM (Qverify_visited_file_modtime, "verify-visited-file-modtime");
5905 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime"); 5831 DEFSYM (Qset_visited_file_modtime, "set-visited-file-modtime");
5832
5833 /* The symbol bound to coding-system-for-read when
5834 insert-file-contents is called for recovering a file. This is not
5835 an actual coding system name, but just an indicator to tell
5836 insert-file-contents to use `emacs-mule' with a special flag for
5837 auto saving and recovering a file. */
5906 DEFSYM (Qauto_save_coding, "auto-save-coding"); 5838 DEFSYM (Qauto_save_coding, "auto-save-coding");
5907 5839
5908 DEFSYM (Qfile_name_history, "file-name-history"); 5840 DEFSYM (Qfile_name_history, "file-name-history");
@@ -5938,9 +5870,14 @@ On MS-Windows, the value of this variable is largely ignored if
5938behaves as if file names were encoded in `utf-8'. */); 5870behaves as if file names were encoded in `utf-8'. */);
5939 Vdefault_file_name_coding_system = Qnil; 5871 Vdefault_file_name_coding_system = Qnil;
5940 5872
5873 /* Lisp functions for translating file formats. */
5941 DEFSYM (Qformat_decode, "format-decode"); 5874 DEFSYM (Qformat_decode, "format-decode");
5942 DEFSYM (Qformat_annotate_function, "format-annotate-function"); 5875 DEFSYM (Qformat_annotate_function, "format-annotate-function");
5876
5877 /* Lisp function for setting buffer-file-coding-system and the
5878 multibyteness of the current buffer after inserting a file. */
5943 DEFSYM (Qafter_insert_file_set_coding, "after-insert-file-set-coding"); 5879 DEFSYM (Qafter_insert_file_set_coding, "after-insert-file-set-coding");
5880
5944 DEFSYM (Qcar_less_than_car, "car-less-than-car"); 5881 DEFSYM (Qcar_less_than_car, "car-less-than-car");
5945 5882
5946 Fput (Qfile_error, Qerror_conditions, 5883 Fput (Qfile_error, Qerror_conditions,
@@ -6094,11 +6031,17 @@ When non-nil, certain file deletion commands use the function
6094This includes interactive calls to `delete-file' and 6031This includes interactive calls to `delete-file' and
6095`delete-directory' and the Dired deletion commands. */); 6032`delete-directory' and the Dired deletion commands. */);
6096 delete_by_moving_to_trash = 0; 6033 delete_by_moving_to_trash = 0;
6097 Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash"); 6034 DEFSYM (Qdelete_by_moving_to_trash, "delete-by-moving-to-trash");
6098 6035
6036 /* Lisp function for moving files to trash. */
6099 DEFSYM (Qmove_file_to_trash, "move-file-to-trash"); 6037 DEFSYM (Qmove_file_to_trash, "move-file-to-trash");
6038
6039 /* Lisp function for recursively copying directories. */
6100 DEFSYM (Qcopy_directory, "copy-directory"); 6040 DEFSYM (Qcopy_directory, "copy-directory");
6041
6042 /* Lisp function for recursively deleting directories. */
6101 DEFSYM (Qdelete_directory, "delete-directory"); 6043 DEFSYM (Qdelete_directory, "delete-directory");
6044
6102 DEFSYM (Qsubstitute_env_in_file_name, "substitute-env-in-file-name"); 6045 DEFSYM (Qsubstitute_env_in_file_name, "substitute-env-in-file-name");
6103 DEFSYM (Qget_buffer_window_list, "get-buffer-window-list"); 6046 DEFSYM (Qget_buffer_window_list, "get-buffer-window-list");
6104 6047