comparison src/fileio.c @ 17396:7fbce3c83857

(Finsert_file_contents): Do call signal_after_change when REPLACE is handled by reading directly from the file. Use insert_1 to insert replacement text, to avoid query about whether to modify the buffer.
author Richard M. Stallman <rms@gnu.org>
date Fri, 11 Apr 1997 18:25:41 +0000
parents b1cb0037ecec
children ba848dceb1c9
comparison
equal deleted inserted replaced
17395:ad9d92edda0d 17396:7fbce3c83857
3466 and update INSERTED to equal the number of bytes 3466 and update INSERTED to equal the number of bytes
3467 we are taking from the file. */ 3467 we are taking from the file. */
3468 inserted -= (Z - same_at_end) + (same_at_start - BEG); 3468 inserted -= (Z - same_at_end) + (same_at_start - BEG);
3469 move_gap (same_at_start); 3469 move_gap (same_at_start);
3470 del_range_1 (same_at_start, same_at_end, 0); 3470 del_range_1 (same_at_start, same_at_end, 0);
3471 insert (conversion_buffer + same_at_start - BEG, inserted); 3471 SET_PT (same_at_start);
3472 insert_1 (conversion_buffer + same_at_start - BEG, inserted, 0, 0);
3472 3473
3473 free (conversion_buffer); 3474 free (conversion_buffer);
3474 close (fd); 3475 close (fd);
3475 specpdl_ptr--; 3476 specpdl_ptr--;
3476 3477
3685 Qnil, make_number (inserted), visit); 3686 Qnil, make_number (inserted), visit);
3686 CHECK_NUMBER (insval, 0); 3687 CHECK_NUMBER (insval, 0);
3687 inserted = XFASTINT (insval); 3688 inserted = XFASTINT (insval);
3688 } 3689 }
3689 3690
3690 if (inserted > 0 && NILP (visit) && total > 0) 3691 /* Call after-change hooks for the inserted text, aside from the case
3692 of normal visiting (not with REPLACE), which is done in a new buffer
3693 "before" the buffer is changed. */
3694 if (inserted > 0 && total > 0
3695 && (NILP (visit) || !NILP (replace)))
3691 signal_after_change (PT, 0, inserted); 3696 signal_after_change (PT, 0, inserted);
3692 3697
3693 if (inserted > 0) 3698 if (inserted > 0)
3694 { 3699 {
3695 p = Vafter_insert_file_functions; 3700 p = Vafter_insert_file_functions;