diff options
| author | Richard M. Stallman | 1995-08-14 17:26:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-08-14 17:26:27 +0000 |
| commit | 7204a979c6e91be39a0549949c983f0d504bf711 (patch) | |
| tree | db005bf24a327e6cfea9154e26514669be94a4aa /src | |
| parent | 8909596294fe0aebe9451e432d74a1c368dfb737 (diff) | |
| download | emacs-7204a979c6e91be39a0549949c983f0d504bf711.tar.gz emacs-7204a979c6e91be39a0549949c983f0d504bf711.zip | |
(Fwrite_region): New arg lockname.
(auto_save_1): Pass new arg.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/fileio.c b/src/fileio.c index 3465f8cbe03..d58a15041c9 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3128,7 +3128,7 @@ build_annotations_unwind (buf) | |||
| 3128 | return Qnil; | 3128 | return Qnil; |
| 3129 | } | 3129 | } |
| 3130 | 3130 | ||
| 3131 | DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 5, | 3131 | DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 6, |
| 3132 | "r\nFWrite region to file: ", | 3132 | "r\nFWrite region to file: ", |
| 3133 | "Write current region into specified file.\n\ | 3133 | "Write current region into specified file.\n\ |
| 3134 | When called from a program, takes three arguments:\n\ | 3134 | When called from a program, takes three arguments:\n\ |
| @@ -3143,10 +3143,12 @@ If VISIT is a string, it is a second file name;\n\ | |||
| 3143 | VISIT is also the file name to lock and unlock for clash detection.\n\ | 3143 | VISIT is also the file name to lock and unlock for clash detection.\n\ |
| 3144 | If VISIT is neither t nor nil nor a string,\n\ | 3144 | If VISIT is neither t nor nil nor a string,\n\ |
| 3145 | that means do not print the \"Wrote file\" message.\n\ | 3145 | that means do not print the \"Wrote file\" message.\n\ |
| 3146 | The optional sixth arg LOCKNAME, if non-nil, specifies the name to\n\ | ||
| 3147 | use for locking and unlocking, overriding FILENAME and VISIT.\n\ | ||
| 3146 | Kludgy feature: if START is a string, then that string is written\n\ | 3148 | Kludgy feature: if START is a string, then that string is written\n\ |
| 3147 | to the file, instead of any buffer contents, and END is ignored.") | 3149 | to the file, instead of any buffer contents, and END is ignored.") |
| 3148 | (start, end, filename, append, visit) | 3150 | (start, end, filename, append, visit, lockname) |
| 3149 | Lisp_Object start, end, filename, append, visit; | 3151 | Lisp_Object start, end, filename, append, visit, lockname; |
| 3150 | { | 3152 | { |
| 3151 | register int desc; | 3153 | register int desc; |
| 3152 | int failure; | 3154 | int failure; |
| @@ -3163,7 +3165,7 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3163 | Lisp_Object visit_file; | 3165 | Lisp_Object visit_file; |
| 3164 | Lisp_Object annotations; | 3166 | Lisp_Object annotations; |
| 3165 | int visiting, quietly; | 3167 | int visiting, quietly; |
| 3166 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 3168 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 3167 | struct buffer *given_buffer; | 3169 | struct buffer *given_buffer; |
| 3168 | #ifdef DOS_NT | 3170 | #ifdef DOS_NT |
| 3169 | int buffer_file_type | 3171 | int buffer_file_type |
| @@ -3176,7 +3178,7 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3176 | if (!NILP (start) && !STRINGP (start)) | 3178 | if (!NILP (start) && !STRINGP (start)) |
| 3177 | validate_region (&start, &end); | 3179 | validate_region (&start, &end); |
| 3178 | 3180 | ||
| 3179 | GCPRO2 (filename, visit); | 3181 | GCPRO3 (filename, visit, lockname); |
| 3180 | filename = Fexpand_file_name (filename, Qnil); | 3182 | filename = Fexpand_file_name (filename, Qnil); |
| 3181 | if (STRINGP (visit)) | 3183 | if (STRINGP (visit)) |
| 3182 | visit_file = Fexpand_file_name (visit, Qnil); | 3184 | visit_file = Fexpand_file_name (visit, Qnil); |
| @@ -3189,7 +3191,10 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3189 | 3191 | ||
| 3190 | annotations = Qnil; | 3192 | annotations = Qnil; |
| 3191 | 3193 | ||
| 3192 | GCPRO4 (start, filename, annotations, visit_file); | 3194 | if (NILP (lockname)) |
| 3195 | lockname = visit_file; | ||
| 3196 | |||
| 3197 | GCPRO5 (start, filename, annotations, visit_file, lockname); | ||
| 3193 | 3198 | ||
| 3194 | /* If the file name has special constructs in it, | 3199 | /* If the file name has special constructs in it, |
| 3195 | call the corresponding file handler. */ | 3200 | call the corresponding file handler. */ |
| @@ -3234,7 +3239,7 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3234 | 3239 | ||
| 3235 | #ifdef CLASH_DETECTION | 3240 | #ifdef CLASH_DETECTION |
| 3236 | if (!auto_saving) | 3241 | if (!auto_saving) |
| 3237 | lock_file (visit_file); | 3242 | lock_file (lockname); |
| 3238 | #endif /* CLASH_DETECTION */ | 3243 | #endif /* CLASH_DETECTION */ |
| 3239 | 3244 | ||
| 3240 | fn = XSTRING (filename)->data; | 3245 | fn = XSTRING (filename)->data; |
| @@ -3308,7 +3313,7 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3308 | { | 3313 | { |
| 3309 | #ifdef CLASH_DETECTION | 3314 | #ifdef CLASH_DETECTION |
| 3310 | save_errno = errno; | 3315 | save_errno = errno; |
| 3311 | if (!auto_saving) unlock_file (visit_file); | 3316 | if (!auto_saving) unlock_file (lockname); |
| 3312 | errno = save_errno; | 3317 | errno = save_errno; |
| 3313 | #endif /* CLASH_DETECTION */ | 3318 | #endif /* CLASH_DETECTION */ |
| 3314 | report_file_error ("Opening output file", Fcons (filename, Qnil)); | 3319 | report_file_error ("Opening output file", Fcons (filename, Qnil)); |
| @@ -3320,7 +3325,7 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3320 | if (lseek (desc, 0, 2) < 0) | 3325 | if (lseek (desc, 0, 2) < 0) |
| 3321 | { | 3326 | { |
| 3322 | #ifdef CLASH_DETECTION | 3327 | #ifdef CLASH_DETECTION |
| 3323 | if (!auto_saving) unlock_file (visit_file); | 3328 | if (!auto_saving) unlock_file (lockname); |
| 3324 | #endif /* CLASH_DETECTION */ | 3329 | #endif /* CLASH_DETECTION */ |
| 3325 | report_file_error ("Lseek error", Fcons (filename, Qnil)); | 3330 | report_file_error ("Lseek error", Fcons (filename, Qnil)); |
| 3326 | } | 3331 | } |
| @@ -3443,7 +3448,7 @@ to the file, instead of any buffer contents, and END is ignored.") | |||
| 3443 | 3448 | ||
| 3444 | #ifdef CLASH_DETECTION | 3449 | #ifdef CLASH_DETECTION |
| 3445 | if (!auto_saving) | 3450 | if (!auto_saving) |
| 3446 | unlock_file (visit_file); | 3451 | unlock_file (lockname); |
| 3447 | #endif /* CLASH_DETECTION */ | 3452 | #endif /* CLASH_DETECTION */ |
| 3448 | 3453 | ||
| 3449 | /* Do this before reporting IO error | 3454 | /* Do this before reporting IO error |
| @@ -3749,7 +3754,7 @@ auto_save_1 () | |||
| 3749 | return | 3754 | return |
| 3750 | Fwrite_region (Qnil, Qnil, | 3755 | Fwrite_region (Qnil, Qnil, |
| 3751 | current_buffer->auto_save_file_name, | 3756 | current_buffer->auto_save_file_name, |
| 3752 | Qnil, Qlambda); | 3757 | Qnil, Qlambda, Qnil); |
| 3753 | } | 3758 | } |
| 3754 | 3759 | ||
| 3755 | static Lisp_Object | 3760 | static Lisp_Object |