GNU bug report logs - #11303
Whitespace mode causes auto-save to malfunction

Previous Next

Package: emacs;

Reported by: Kelly Dean <kellydeanch <at> yahoo.com>

Date: Sat, 21 Apr 2012 17:50:02 UTC

Severity: normal

Tags: confirmed

Found in version 26.1

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11303 in the body.
You can then email your comments to 11303 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11303; Package emacs. (Sat, 21 Apr 2012 17:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kelly Dean <kellydeanch <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Apr 2012 17:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kelly Dean <kellydeanch <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Whitespace mode causes auto-save to malfunction
Date: Sat, 21 Apr 2012 02:49:36 -0700 (PDT)
I'm using Emacs on X on Debian 6 Stable. emacs-version says GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-11 on raven, modified by Debian.
Steps to reproduce the bug:
Delete your .emacs file.
Start X, and start Emacs with no options.
Open any writeable file, then press space, so that the buffer is modified.
Wait for the auto-save timeout. Emacs writes the auto-save file.
Press C-g.
Wait for the auto-save timeout again. Notice that Emacs does not write the auto-save file again, because the buffer hasn't changed since the last auto-save. This is the correct behavior.
Now, close Emacs, and put just the following in your .emacs file:
(global-whitespace-mode 1)
Start Emacs with no options.
Open a file, press space, wait for the timeout, press C-g, and wait for the timeout again. Notice that Emacs does write the auto-save file again, even though the buffer hasn't changed since the last auto-save. This is not the correct behavior.
This can cause various problems, for example unnecessarily spinning up a sleeping disk to write the auto-save file, and the timestamp on the auto-save file can't be relied on to show when (approximately, with accuracy determined by the value of auto-save-timeout) the buffer was last modified.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11303; Package emacs. (Sat, 02 Jun 2012 21:25:02 GMT) Full text and rfc822 format available.

Message #8 received at 11303 <at> debbugs.gnu.org (full text, mbox):

From: Kelly Dean <kellydeanch <at> yahoo.com>
To: 11303 <at> debbugs.gnu.org
Subject: Whitespace mode causes auto-save to malfunction
Date: Sat, 2 Jun 2012 14:22:26 -0700 (PDT)
This bug is reproducible on 24.1-rc1. (emacs-version reports "GNU Emacs 24.1.1 (i686-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2012-06-01 on localhost")





bug Marked as found in versions 26.1. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 21 Sep 2018 12:38:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 21 Sep 2018 12:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11303; Package emacs. (Fri, 16 Jul 2021 11:56:02 GMT) Full text and rfc822 format available.

Message #15 received at 11303 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kelly Dean <kellydeanch <at> yahoo.com>
Cc: 11303 <at> debbugs.gnu.org
Subject: Re: bug#11303: Whitespace mode causes auto-save to malfunction
Date: Fri, 16 Jul 2021 13:55:44 +0200
Kelly Dean <kellydeanch <at> yahoo.com> writes:

> Start Emacs with no options.
> Open a file, press space, wait for the timeout, press C-g, and wait
> for the timeout again. Notice that Emacs does write the auto-save file
> again, even though the buffer hasn't changed since the last
> auto-save. This is not the correct behavior.

This problem is still present in Emacs 28.

Poking around a bit at this, it seems that it's the call to

(jit-lock-refontify (point-min) (point-max))

that makes `M-x do-auto-save' auto-save again (even if nothing has
changed except the text properties in the buffer).

I.e., doing

(put-text-property 1 3 'face 'bold)

will make the buffer eligible for auto-saving again, even if putting
those text properties into the buffer doesn't switch from unmodified to
modified.

That's pretty inconsistent behaviour, at least?  I'm guessing this stems
from text properties upping the BUF_MODIFF, but not changing the buffer
modification status.

Does this sound like the correct analysis?  If so, what can we do about
it?  (`with-silent-modifications' doesn't seem to have any effect here.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11303; Package emacs. (Fri, 16 Jul 2021 12:02:02 GMT) Full text and rfc822 format available.

Message #18 received at 11303 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 11303 <at> debbugs.gnu.org, kellydeanch <at> yahoo.com
Subject: Re: bug#11303: Whitespace mode causes auto-save to malfunction
Date: Fri, 16 Jul 2021 15:00:56 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Fri, 16 Jul 2021 13:55:44 +0200
> Cc: 11303 <at> debbugs.gnu.org
> 
> Kelly Dean <kellydeanch <at> yahoo.com> writes:
> 
> > Start Emacs with no options.
> > Open a file, press space, wait for the timeout, press C-g, and wait
> > for the timeout again. Notice that Emacs does write the auto-save file
> > again, even though the buffer hasn't changed since the last
> > auto-save. This is not the correct behavior.
> 
> This problem is still present in Emacs 28.
> 
> Poking around a bit at this, it seems that it's the call to
> 
> (jit-lock-refontify (point-min) (point-max))
> 
> that makes `M-x do-auto-save' auto-save again (even if nothing has
> changed except the text properties in the buffer).
> 
> I.e., doing
> 
> (put-text-property 1 3 'face 'bold)
> 
> will make the buffer eligible for auto-saving again, even if putting
> those text properties into the buffer doesn't switch from unmodified to
> modified.
> 
> That's pretty inconsistent behaviour, at least?  I'm guessing this stems
> from text properties upping the BUF_MODIFF, but not changing the buffer
> modification status.
> 
> Does this sound like the correct analysis?  If so, what can we do about
> it?  (`with-silent-modifications' doesn't seem to have any effect here.)

The OP's recipe includes C-g, which could mean we lack an
unwind-protect somewhere, and the buffer stays modified due to changes
in faces.

The fact that changes in faces cause the buffer become eligible for
auto-saving is not a bug, IMO, it's a feature.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11303; Package emacs. (Fri, 16 Jul 2021 12:07:02 GMT) Full text and rfc822 format available.

Message #21 received at 11303 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 11303 <at> debbugs.gnu.org, kellydeanch <at> yahoo.com
Subject: Re: bug#11303: Whitespace mode causes auto-save to malfunction
Date: Fri, 16 Jul 2021 14:06:46 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> The OP's recipe includes C-g, which could mean we lack an
> unwind-protect somewhere, and the buffer stays modified due to changes
> in faces.

The C-g isn't necessary to reproduce the issue.

> The fact that changes in faces cause the buffer become eligible for
> auto-saving is not a bug, IMO, it's a feature.

It's pretty annoying when using whitespace-mode -- which changes the
text properties all the time when you move around in the buffer (without
modifying the buffer).  It's not really that much of an issue elsewhere,
where font lock changes usually only happen when you actually edit the
buffer.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11303; Package emacs. (Sat, 07 May 2022 10:09:02 GMT) Full text and rfc822 format available.

Message #24 received at 11303 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Kelly Dean <kellydeanch <at> yahoo.com>
Cc: 11303 <at> debbugs.gnu.org
Subject: Re: bug#11303: Whitespace mode causes auto-save to malfunction
Date: Sat, 07 May 2022 12:07:57 +0200
Kelly Dean <kellydeanch <at> yahoo.com> writes:

> Notice that Emacs does write the auto-save file
> again, even though the buffer hasn't changed since the last
> auto-save. This is not the correct behavior.

I've now fixed this in Emacs 29.  The problem wasn't limited to
whitespace mode, but all modes that do font locking.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 11303 <at> debbugs.gnu.org and Kelly Dean <kellydeanch <at> yahoo.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 07 May 2022 10:09:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 04 Jun 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.