Subject: Re: bug#60066: 30.0.50; whitespace-mode modifies buffer

From: Bastian Beranek <[email-masked]>
Date: Wed, 14 Dec 2022 17:53:54 +0100

On Wed, Dec 14, 2022 at 5:15 PM Eli Zaretskii <[email-masked]> wrote:
>
> > From: Bastian Beranek <[email-masked]>
> > Date: Wed, 14 Dec 2022 15:26:03 +0100
> >
> >
> > I have
> >
> > (add-hook 'c-mode-common-hook 'whitespace-mode)
> >
> > in my .emacs and I am using emacs master (which includes
> > whitespace.el). When opening a source file in my project the buffer
> > immediately is marked as modified and emacs will ask to save the buffer
> > when trying to kill it.
> >
> > I was able to trace this back to the above line in my .emacs. If I don't
> > enable whitespace-mode in the hook the buffer is not marked as modified
> > when opening the .C file.
> >
> > With my configuration I would not expect whitespace-mode to make any
> > changes to the buffer.
> >
> > I went back to whitespace.el from commit
> >
> > 29eb4596956a74a83ceb4c17835886a23ea0dd20
> >
> > and the problem is fixed. So I assume it is a recent regression in
> > whitespace.el.
>
> Richard, could you please look into this?  It sounds like your recent
> changes to whitespace.el could be the culprit for this regression.  I
> guess something like with-silent-modifications is missing somewhere?

It might be worth pointing out that there are no actual differences
between the buffer and its on-disk counterpart, but still emacs
considers the buffer to be modified, as if a change was made and
reverted (but not through undo).