This fixes issues where the buffer's modified state isn't reflected properly in the mode-line, at the expense of a little (but acceptable loss of) efficiency.
d8928d4a