comparison src/fileio.c @ 3814:b98f0084dc23

[xemacs-hg @ 2007-02-05 15:33:17 by michaels] 2007-02-05 Mike Sperber <mike@xemacs.org> * fileio.c (Finsert_file_contents_internal): Clean up dead `handler' variable.
author michaels
date Mon, 05 Feb 2007 15:33:19 +0000
parents a257e03c580e
children 5989b9bbb612
comparison
equal deleted inserted replaced
3813:ccceded4ee72 3814:b98f0084dc23
2884 int fd; 2884 int fd;
2885 int saverrno = 0; 2885 int saverrno = 0;
2886 Charcount inserted = 0; 2886 Charcount inserted = 0;
2887 int speccount; 2887 int speccount;
2888 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 2888 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
2889 Lisp_Object handler = Qnil, val; 2889 Lisp_Object val;
2890 int total; 2890 int total;
2891 Ibyte read_buf[READ_BUF_SIZE]; 2891 Ibyte read_buf[READ_BUF_SIZE];
2892 int mc_count; 2892 int mc_count;
2893 struct buffer *buf = current_buffer; 2893 struct buffer *buf = current_buffer;
2894 Lisp_Object curbuf; 2894 Lisp_Object curbuf;
2907 /* #### dmoore - should probably check in various places to see if 2907 /* #### dmoore - should probably check in various places to see if
2908 curbuf was killed and if so signal an error? */ 2908 curbuf was killed and if so signal an error? */
2909 2909
2910 curbuf = wrap_buffer (buf); 2910 curbuf = wrap_buffer (buf);
2911 2911
2912 GCPRO5 (filename, val, visit, handler, curbuf); 2912 GCPRO4 (filename, val, visit, curbuf);
2913 2913
2914 mc_count = (NILP (replace)) ? 2914 mc_count = (NILP (replace)) ?
2915 begin_multiple_change (buf, BUF_PT (buf), BUF_PT (buf)) : 2915 begin_multiple_change (buf, BUF_PT (buf), BUF_PT (buf)) :
2916 begin_multiple_change (buf, BUF_BEG (buf), BUF_Z (buf)); 2916 begin_multiple_change (buf, BUF_BEG (buf), BUF_Z (buf));
2917 2917
3228 3228
3229 if (!NILP (visit)) 3229 if (!NILP (visit))
3230 { 3230 {
3231 if (!EQ (buf->undo_list, Qt)) 3231 if (!EQ (buf->undo_list, Qt))
3232 buf->undo_list = Qnil; 3232 buf->undo_list = Qnil;
3233 if (NILP (handler)) 3233 buf->modtime = st.st_mtime;
3234 { 3234 buf->filename = filename;
3235 buf->modtime = st.st_mtime; 3235 /* XEmacs addition: */
3236 buf->filename = filename; 3236 /* This function used to be in C, ostensibly so that
3237 /* XEmacs addition: */ 3237 it could be called here. But that's just silly.
3238 /* This function used to be in C, ostensibly so that 3238 There's no reason C code can't call out to Lisp
3239 it could be called here. But that's just silly. 3239 code, and it's a lot cleaner this way. */
3240 There's no reason C code can't call out to Lisp 3240 /* Note: compute-buffer-file-truename is called for
3241 code, and it's a lot cleaner this way. */ 3241 side-effect! Its return value is intentionally
3242 /* Note: compute-buffer-file-truename is called for 3242 ignored. */
3243 side-effect! Its return value is intentionally 3243 if (!NILP (Ffboundp (Qcompute_buffer_file_truename)))
3244 ignored. */ 3244 call1 (Qcompute_buffer_file_truename, wrap_buffer (buf));
3245 if (!NILP (Ffboundp (Qcompute_buffer_file_truename)))
3246 call1 (Qcompute_buffer_file_truename, wrap_buffer (buf));
3247 }
3248 BUF_SAVE_MODIFF (buf) = BUF_MODIFF (buf); 3245 BUF_SAVE_MODIFF (buf) = BUF_MODIFF (buf);
3249 buf->auto_save_modified = BUF_MODIFF (buf); 3246 buf->auto_save_modified = BUF_MODIFF (buf);
3250 buf->saved_size = make_int (BUF_SIZE (buf)); 3247 buf->saved_size = make_int (BUF_SIZE (buf));
3251 #ifdef CLASH_DETECTION 3248 #ifdef CLASH_DETECTION
3252 if (NILP (handler)) 3249 if (!NILP (buf->file_truename))
3253 { 3250 unlock_file (buf->file_truename);
3254 if (!NILP (buf->file_truename)) 3251 unlock_file (filename);
3255 unlock_file (buf->file_truename);
3256 unlock_file (filename);
3257 }
3258 #endif /* CLASH_DETECTION */ 3252 #endif /* CLASH_DETECTION */
3259 if (not_regular) 3253 if (not_regular)
3260 RETURN_UNGCPRO (Fsignal (Qfile_error, 3254 RETURN_UNGCPRO (Fsignal (Qfile_error,
3261 list2 (build_msg_string ("not a regular file"), 3255 list2 (build_msg_string ("not a regular file"),
3262 filename))); 3256 filename)));