changeset 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 ad9d92edda0d
children e1bc0ba41a50
files src/fileio.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Fri Apr 11 13:35:19 1997 +0000
+++ b/src/fileio.c	Fri Apr 11 18:25:41 1997 +0000
@@ -3468,7 +3468,8 @@
       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 @@
       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)