From 62bcf0098d9c3d46070cb003ddd341174a37d09f Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 31 Dec 1993 12:56:41 +0000 Subject: [PATCH] (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. --- src/fileio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index cb06ce57b86..a71d4a17d03 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2394,6 +2394,7 @@ If VISIT is non-nil, BEG and END must be nil.") Lisp_Object handler, val, insval; Lisp_Object p; int total; + int handled = 0; val = Qnil; p = Qnil; @@ -2411,6 +2412,7 @@ If VISIT is non-nil, BEG and END must be nil.") if (!NILP (handler)) { val = call5 (handler, Qinsert_file_contents, filename, visit, beg, end); + handled = 1; goto handled; } @@ -2541,7 +2543,10 @@ If VISIT is non-nil, BEG and END must be nil.") #ifdef APOLLO stat (XSTRING (filename)->data, &st); #endif - current_buffer->modtime = st.st_mtime; + + if (! handled) + current_buffer->modtime = st.st_mtime; + current_buffer->save_modified = MODIFF; current_buffer->auto_save_modified = MODIFF; XFASTINT (current_buffer->save_length) = Z - BEG; @@ -2559,7 +2564,7 @@ If VISIT is non-nil, BEG and END must be nil.") report_file_error ("Opening input file", Fcons (filename, Qnil)); } - if (NILP (visit) && total > 0) + if (inserted > 0 && NILP (visit) && total > 0) signal_after_change (point, 0, inserted); if (inserted > 0) -- 2.39.5