lewang / ws-butler

Unobtrusively trim extraneous white-space *ONLY* in lines edited.
242 stars 26 forks source link

Inhibit modification hooks in ws-butler-after-save #31

Closed hlissner closed 3 years ago

hlissner commented 5 years ago

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:

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!

lewang commented 3 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.

dcolascione commented 3 years ago

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.

lewang commented 3 years ago

@dcolascione Sounds reasonable. Thanks!