comparison src/fileio.c @ 5390:d9c81d7079f3

(Finsert_file_contents): Don't run after change hook if inserted is 0. New local `handled', set if run handler. Avoid setting modtime field if ran a handler.
author Richard M. Stallman <rms@gnu.org>
date Fri, 31 Dec 1993 12:56:41 +0000
parents 8e1536744d7e
children e11486a64dab
comparison
equal deleted inserted replaced
5389:09148c696fa2 5390:d9c81d7079f3
2392 int count = specpdl_ptr - specpdl; 2392 int count = specpdl_ptr - specpdl;
2393 struct gcpro gcpro1, gcpro2; 2393 struct gcpro gcpro1, gcpro2;
2394 Lisp_Object handler, val, insval; 2394 Lisp_Object handler, val, insval;
2395 Lisp_Object p; 2395 Lisp_Object p;
2396 int total; 2396 int total;
2397 int handled = 0;
2397 2398
2398 val = Qnil; 2399 val = Qnil;
2399 p = Qnil; 2400 p = Qnil;
2400 2401
2401 GCPRO2 (filename, p); 2402 GCPRO2 (filename, p);
2409 call the corresponding file handler. */ 2410 call the corresponding file handler. */
2410 handler = Ffind_file_name_handler (filename); 2411 handler = Ffind_file_name_handler (filename);
2411 if (!NILP (handler)) 2412 if (!NILP (handler))
2412 { 2413 {
2413 val = call5 (handler, Qinsert_file_contents, filename, visit, beg, end); 2414 val = call5 (handler, Qinsert_file_contents, filename, visit, beg, end);
2415 handled = 1;
2414 goto handled; 2416 goto handled;
2415 } 2417 }
2416 2418
2417 fd = -1; 2419 fd = -1;
2418 2420
2539 { 2541 {
2540 current_buffer->undo_list = Qnil; 2542 current_buffer->undo_list = Qnil;
2541 #ifdef APOLLO 2543 #ifdef APOLLO
2542 stat (XSTRING (filename)->data, &st); 2544 stat (XSTRING (filename)->data, &st);
2543 #endif 2545 #endif
2544 current_buffer->modtime = st.st_mtime; 2546
2547 if (! handled)
2548 current_buffer->modtime = st.st_mtime;
2549
2545 current_buffer->save_modified = MODIFF; 2550 current_buffer->save_modified = MODIFF;
2546 current_buffer->auto_save_modified = MODIFF; 2551 current_buffer->auto_save_modified = MODIFF;
2547 XFASTINT (current_buffer->save_length) = Z - BEG; 2552 XFASTINT (current_buffer->save_length) = Z - BEG;
2548 #ifdef CLASH_DETECTION 2553 #ifdef CLASH_DETECTION
2549 if (NILP (handler)) 2554 if (NILP (handler))
2557 /* If visiting nonexistent file, return nil. */ 2562 /* If visiting nonexistent file, return nil. */
2558 if (current_buffer->modtime == -1) 2563 if (current_buffer->modtime == -1)
2559 report_file_error ("Opening input file", Fcons (filename, Qnil)); 2564 report_file_error ("Opening input file", Fcons (filename, Qnil));
2560 } 2565 }
2561 2566
2562 if (NILP (visit) && total > 0) 2567 if (inserted > 0 && NILP (visit) && total > 0)
2563 signal_after_change (point, 0, inserted); 2568 signal_after_change (point, 0, inserted);
2564 2569
2565 if (inserted > 0) 2570 if (inserted > 0)
2566 { 2571 {
2567 p = Vafter_insert_file_functions; 2572 p = Vafter_insert_file_functions;