From 0342d8c579a4b9d7b6377e0fc92d74acd2acd0a9 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 11 Apr 1997 18:25:41 +0000 Subject: [PATCH] (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. --- src/fileio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 0e04ef4a3d9..3be84dcb52f 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3468,7 +3468,8 @@ This does code conversion according to the value of\n\ inserted -= (Z - same_at_end) + (same_at_start - BEG); move_gap (same_at_start); del_range_1 (same_at_start, same_at_end, 0); - insert (conversion_buffer + same_at_start - BEG, inserted); + SET_PT (same_at_start); + insert_1 (conversion_buffer + same_at_start - BEG, inserted, 0, 0); free (conversion_buffer); close (fd); @@ -3687,7 +3688,11 @@ This does code conversion according to the value of\n\ inserted = XFASTINT (insval); } - if (inserted > 0 && NILP (visit) && total > 0) + /* Call after-change hooks for the inserted text, aside from the case + of normal visiting (not with REPLACE), which is done in a new buffer + "before" the buffer is changed. */ + if (inserted > 0 && total > 0 + && (NILP (visit) || !NILP (replace))) signal_after_change (PT, 0, inserted); if (inserted > 0) -- 2.39.5