[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unbalanced change hooks (part 2)

From: Alan Mackenzie
Subject: Unbalanced change hooks (part 2)
Date: Sun, 31 Jul 2016 12:16:42 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Emacs.

There are several functions in .../src/insdel.c which have a parameter
`prepare'.  The meaning of `prepare' is "direct the function to call
prepare_to_modify_buffer" (YUCK!).  Thus, whether or not
before-change-functions is invoked is determined by the `prepare'

The pertinent functions are insert_1_both, replace_range, del_range_1,
del_range_byte, and del_range_both.  These functions fall into two
groups, the first two in group 1 and the rest in group 2.  Those in group
2 always call signal_after_change, those in group 1 never do.

There are invocations of group 2 functions with `prepare' false.  This
wrongly invokes after-change-functions without having invoked

All the invocations of group 1 functions I've checked so far balance a
true `prepare' with an explicit call of signal_after_change.

At the heart of the problem is the lack of coherence in
prepare_to_modify_buffer.  This function has no definite coherent
function, the best description that can be given it being "perform some
of the things which need doing before a buffer change".  It is unclear
which of these things is unwanted when `prepare' is set to false.

The group 2 functions always invoke after-change-functions, so they must
always invoke before-change-functions.  In Finsert_file_contents there
are instances of del_range_byte with `prepare' false.  The spurious lack
of the before-change-functions invocation fouls up CC Mode, causing bug

I propose that the call to signal_before_change should be removed from
prepare_to_modify_buffer, and that it should be called explicitly from
the places it is needed.  This would allow bug #240[79]4 to be fixed.


Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]