Closed hlissner closed 4 years ago
thanks!
I'm a bit concerned about
undo data may become corrupted
from docs of with-silent-modifications
, but let's give this a whirl regardless.
I don't think this change is right. Modes are allowed to do arbitrary reparsing in response to buffer change hooks: for example, a mode could store a parse tree keyed on character counts from the start of the buffer. Modifying the buffer using with-silent-modifications
can break mode parsing. doom-modeline should change instead.
@dcolascione Sounds reasonable. Thanks!
This PR sets out to fix https://github.com/seagle0128/doom-modeline/issues/129.
What this PR does: it inhibits modification hooks while ws-butler-after-save restores virtual whitespace to the buffer post-save.
Rationale:
after-save-hook
andafter-change-functions
to update a buffer-modified indicator in the mode line.insert
and forcedmove-to-column
calls inws-butler-after-save
triggerafter-change-functions
when writing virtual whitespace into the buffer (causing doom-modeline to indicate the buffer has changed).after-save-hook
, so the subsequent call to(set-buffer-modified-p nil)
will not reach doom-modeline.ws-butler-after-save
is appended toafter-save-hook
buffer-locally, the only way for doom-modeline to sneak a update hook into it by making users aware of the race condition, or accommodating ws-butler specifically.Thus, doom-modeline incorrectly reports a modified buffer when it isn't modified.
It's debatable whether doom-modeline or ws-butler should adapt, but I didn't think insertion of virtual whitespace should trigger modfiication hooks in the first place, so here I am!