# HG changeset patch # User Richard M. Stallman # Date 808421187 0 # Node ID 032f8aae6bbe2c6046a524c5631caa2ea14b3c59 # Parent 0b04a441c06d79f41c2fdb7a7ebf7006c076626a (Fwrite_region): New arg lockname. (auto_save_1): Pass new arg. diff -r 0b04a441c06d -r 032f8aae6bbe src/fileio.c --- a/src/fileio.c Mon Aug 14 17:24:21 1995 +0000 +++ b/src/fileio.c Mon Aug 14 17:26:27 1995 +0000 @@ -3128,7 +3128,7 @@ return Qnil; } -DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 5, +DEFUN ("write-region", Fwrite_region, Swrite_region, 3, 6, "r\nFWrite region to file: ", "Write current region into specified file.\n\ When called from a program, takes three arguments:\n\ @@ -3143,10 +3143,12 @@ VISIT is also the file name to lock and unlock for clash detection.\n\ If VISIT is neither t nor nil nor a string,\n\ that means do not print the \"Wrote file\" message.\n\ +The optional sixth arg LOCKNAME, if non-nil, specifies the name to\n\ + use for locking and unlocking, overriding FILENAME and VISIT.\n\ Kludgy feature: if START is a string, then that string is written\n\ to the file, instead of any buffer contents, and END is ignored.") - (start, end, filename, append, visit) - Lisp_Object start, end, filename, append, visit; + (start, end, filename, append, visit, lockname) + Lisp_Object start, end, filename, append, visit, lockname; { register int desc; int failure; @@ -3163,7 +3165,7 @@ Lisp_Object visit_file; Lisp_Object annotations; int visiting, quietly; - struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; + struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; struct buffer *given_buffer; #ifdef DOS_NT int buffer_file_type @@ -3176,7 +3178,7 @@ if (!NILP (start) && !STRINGP (start)) validate_region (&start, &end); - GCPRO2 (filename, visit); + GCPRO3 (filename, visit, lockname); filename = Fexpand_file_name (filename, Qnil); if (STRINGP (visit)) visit_file = Fexpand_file_name (visit, Qnil); @@ -3189,7 +3191,10 @@ annotations = Qnil; - GCPRO4 (start, filename, annotations, visit_file); + if (NILP (lockname)) + lockname = visit_file; + + GCPRO5 (start, filename, annotations, visit_file, lockname); /* If the file name has special constructs in it, call the corresponding file handler. */ @@ -3234,7 +3239,7 @@ #ifdef CLASH_DETECTION if (!auto_saving) - lock_file (visit_file); + lock_file (lockname); #endif /* CLASH_DETECTION */ fn = XSTRING (filename)->data; @@ -3308,7 +3313,7 @@ { #ifdef CLASH_DETECTION save_errno = errno; - if (!auto_saving) unlock_file (visit_file); + if (!auto_saving) unlock_file (lockname); errno = save_errno; #endif /* CLASH_DETECTION */ report_file_error ("Opening output file", Fcons (filename, Qnil)); @@ -3320,7 +3325,7 @@ if (lseek (desc, 0, 2) < 0) { #ifdef CLASH_DETECTION - if (!auto_saving) unlock_file (visit_file); + if (!auto_saving) unlock_file (lockname); #endif /* CLASH_DETECTION */ report_file_error ("Lseek error", Fcons (filename, Qnil)); } @@ -3443,7 +3448,7 @@ #ifdef CLASH_DETECTION if (!auto_saving) - unlock_file (visit_file); + unlock_file (lockname); #endif /* CLASH_DETECTION */ /* Do this before reporting IO error @@ -3749,7 +3754,7 @@ return Fwrite_region (Qnil, Qnil, current_buffer->auto_save_file_name, - Qnil, Qlambda); + Qnil, Qlambda, Qnil); } static Lisp_Object