GNU bug report logs - #1501
Emacs 22 loses undo buffer

Previous Next

Package: emacs;

Reported by: "Emerick Rogul" <emerick <at> gmail.com>

Date: Fri, 5 Dec 2008 17:00:03 UTC

Severity: wishlist

Tags: patch, wontfix

Merged with 530

Done: Stefan Kangas <stefan <at> marxist.se>

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 1501 in the body.
You can then email your comments to 1501 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Emerick Rogul" <emerick <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Emerick Rogul" <emerick <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Emacs 22 loses undo buffer
Date: Fri, 5 Dec 2008 11:51:12 -0500
Using Emacs 22 on Windows (emacs-version reports "GNU Emacs 22.3.1
(i386-mingw-nt5.1.2600)  of 2008-09-06 on SOFT-MJASON"):

Started emacs with emacs -q --no-site-file.  Opened a C header file
(foo.h) containing about 100-200 lines of code.  Deleted approximately
100 or so lines of code using C-k.  Pressed and held C-/ to undo the
deletions.  Instead of eventually seeing all of my deletions restored,
Emacs complained about "No further undo information" after undeleting
several lines of text.

This works as expected with Emacs 21.2.

Please let me know if I can provide any additional information.

Thanks,

-Emerick





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Emerick Rogul" <emerick <at> gmail.com>
Cc: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Fri, 05 Dec 2008 23:01:56 -0500
There is insufficient information to diagnose the problem you reported.
If possible, please provide the C header file that demonstrates this
problem.  Also, provide *exact* instructions for reproducing the
problem---we need the exact keystrokes you entered, not a vague
description like "deleted approximately 100 or so lines".

Thanks.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Emerick Rogul" <emerick <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Emerick Rogul" <emerick <at> gmail.com>
To: 1501 <at> debbugs.gnu.org
Cc: cyd <at> stupidchicken.com
Subject: Re: Emacs 22 loses undo buffer
Date: Sat, 6 Dec 2008 16:02:59 -0500
[Message part 1 (text/plain, inline)]
Header file attached, although the problem occurs with any header file
(i.e., it's not specific to this particular file).  The trace below
contains the exact key sequence that I typed.

In GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600)
 of 2008-09-06 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: C/l

Minor modes in effect:
  encoded-kbd-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  abbrev-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> C-x C-f <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> c l
r <tab> <return> C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-/ C-/ C-/ C-/ C-/ C-/ C-/
C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/
C-/ ESC x r e p o r t - e m a <tab> <return>

Recent messages:
("C:\\emacs\\bin\\emacs.exe")
Loading encoded-kb...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading cc-mode...done
Undo! [4 times]
undo-more: No further undo information [17 times]
Loading emacsbug...done
[clrdata.h (text/plain, attachment)]

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Emerick Rogul" <emerick <at> gmail.com>
Cc: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Sat, 06 Dec 2008 20:31:10 -0500
"Emerick Rogul" <emerick <at> gmail.com> writes:

> Header file attached, although the problem occurs with any header file
> (i.e., it's not specific to this particular file).  The trace below
> contains the exact key sequence that I typed.

Thanks for the clarification.

What you're encountering is the "undo-limit", which specifies the
maximum amount of undo information to keep.  The default is 20
kilobytes, but you can raise it by changing the variable `undo-limit'.
You can also find details in the Emacs manual.




bug closed, send any further explanations to "Emerick Rogul" <emerick <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 07 Dec 2008 01:45:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Emerick Rogul" <emerick <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #27 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Emerick Rogul" <emerick <at> gmail.com>
To: "Chong Yidong" <cyd <at> stupidchicken.com>
Cc: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Sat, 6 Dec 2008 21:03:01 -0500
That's clearly not the issue at all, since the header file is only 8k
in total size.  What's more, I get the message after hitting the undo
key sequence a couple of times.  Also, this works perfectly fine in
Emacs 21.2, as I mentioned in my initial report.

On Sat, Dec 6, 2008 at 8:31 PM, Chong Yidong <cyd <at> stupidchicken.com> wrote:
> "Emerick Rogul" <emerick <at> gmail.com> writes:
>
>> Header file attached, although the problem occurs with any header file
>> (i.e., it's not specific to this particular file).  The trace below
>> contains the exact key sequence that I typed.
>
> Thanks for the clarification.
>
> What you're encountering is the "undo-limit", which specifies the
> maximum amount of undo information to keep.  The default is 20
> kilobytes, but you can raise it by changing the variable `undo-limit'.
> You can also find details in the Emacs manual.
>




bug reopened, originator not changed. Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 07 Dec 2008 05:35:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #34 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Emerick Rogul" <emerick <at> gmail.com>
Cc: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Sun, 07 Dec 2008 00:36:32 -0500
"Emerick Rogul" <emerick <at> gmail.com> writes:

> That's clearly not the issue at all, since the header file is only 8k
> in total size.  What's more, I get the message after hitting the undo
> key sequence a couple of times.  Also, this works perfectly fine in
> Emacs 21.2, as I mentioned in my initial report.

In the key sequence you reported:

... C-k C-k C-k C-k C-k C-k C-k C-k C-k
C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
[snip]
C-k C-k C-k C-k C-k C-k C-/ C-/ C-/ C-/ C-/ C-/ C-/
C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/
C-/ ESC x r e p o r t - e m a <tab> <return>

it appears that you hit C-/ 22 times.  If Emacs kept 22 undo records,
and each undo record takes about 1 kilobyte, that is enough to hit the
default undo limit.  It might be that each undo record takes more space
in Emacs 23 than in Emacs 21, which is why you don't see the problem in
Emacs 21 (there are several reasons why this could happen, which could
be investigated).

I do observe the same behavior that you reported, using the key sequence
you supplied; furthermore, if I increase undo-limit to a larger number,
I find that Emacs can undo all the way back to the buffer's original
state.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #39 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Emerick Rogul" <emerick <at> gmail.com>
Cc: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Sun, 07 Dec 2008 00:48:53 -0500
Actually, I went back and tried again.  Using the file you supplied, I
had to do C-/ about 100 times before Emacs reached its undo-limit.  That
implies 200 bytes per undo limit, which is about right.

So there does seem to be something strange about the behavior you're
seeing, where Emacs keeps only 20 or so undo records.

Did you enable any other major or minor modes before testing this?

Also, does turning font-lock-mode off change anything?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Emerick Rogul" <emerick <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #44 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Emerick Rogul" <emerick <at> gmail.com>
To: "Chong Yidong" <cyd <at> stupidchicken.com>
Cc: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Sun, 7 Dec 2008 07:36:01 -0500
No, I didn't enable any other major or minor modes before testing.  I
also ran emacs with -q --no-site-file.

Your theory about it being related to font-lock-mode appears to be
correct, however!  I started emacs, loaded the header file, disabled
font-lock-mode, and ran my test again and it behaved as expected
(i.e., it retained all of my undo records).  Is font-lock-mode using
up more records (or more record space) than expected?  I wonder if
it's also Windows-specific in some way?

On Sun, Dec 7, 2008 at 12:48 AM, Chong Yidong <cyd <at> stupidchicken.com> wrote:
> Actually, I went back and tried again.  Using the file you supplied, I
> had to do C-/ about 100 times before Emacs reached its undo-limit.  That
> implies 200 bytes per undo limit, which is about right.
>
> So there does seem to be something strange about the behavior you're
> seeing, where Emacs keeps only 20 or so undo records.
>
> Did you enable any other major or minor modes before testing this?
>
> Also, does turning font-lock-mode off change anything?
>




Merged 530 1501. Request was from Jason Rumney <jasonr <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 20 Dec 2008 10:05:05 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. (Tue, 27 Jan 2009 21:05:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 27 Jan 2009 21:05:06 GMT) Full text and rfc822 format available.

Message #51 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: 1501 <at> debbugs.gnu.org
Subject: Re: Emacs 22 loses undo buffer
Date: Tue, 27 Jan 2009 15:58:55 -0500
I've expanded the undo limits by a factor of four.  A more sophisticated
fix, if one exists, will have to wait till after the release.




Severity set to `wishlist' from `normal' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 27 Jan 2009 21:05:10 GMT) Full text and rfc822 format available.

Severity set to `wishlist' from `wishlist' Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 27 Jan 2009 21:10:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1501; Package emacs. (Fri, 24 Apr 2009 22:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Suresh Kannan <sureshkannan <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Fri, 24 Apr 2009 22:20:03 GMT) Full text and rfc822 format available.

Message #60 received at 1501 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Suresh Kannan <sureshkannan <at> gmail.com>
To: 1501 <at> debbugs.gnu.org
Subject: Emacs 22 loses undo buffer
Date: Fri, 24 Apr 2009 15:14:20 -0700
[Message part 1 (text/plain, inline)]
Hi,

I'm getting the same problem in Emacs 22.2.1 in Ubuntu. Steps to reproduce.

1. start emacs without any resource file (.emacs or any other rc file)  <---
this is avoid if there is some problem with user init file.
2. open file called 'test.c'
3. copy content of "http://www.rfc-editor.org/rfc/rfc2547.txt" into test.c
and save it.
4. do  C-k till section "3.1 Virtual Sites" in the current buffer.
5. Trying continuous C-/, emacs is **not** getting into beginning of the
buffer. I get only few lines as undo. Just 5 lines i can do undo. Not more
than that.

Without font-lock-mode (after disabling font-lock-mode), i tried same
sequence, i can get some more lines in undo but not the whole buffer. So, as
you pointed out font-lock-mode has some impact with undo.

Increased undo-limit,undo-strong-limit,undo-outer-limit to 100,000,000. I
repeated the same steps from 1, 5. This time, I'm able to do full undo.. I
dont mind setting this value in my .emacs because memory is not a problem
for me. But, would this cause any other problem like performance or buffer
loss ?.

Thanks,
Regards,
Suresh Kannan.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Tue, 20 Aug 2019 18:37:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Tue, 20 Aug 2019 20:36:13 +0200
Chong Yidong <cyd <at> stupidchicken.com> writes:

> "Emerick Rogul" <emerick <at> gmail.com> writes:
>
>> That's clearly not the issue at all, since the header file is only 8k
>> in total size.  What's more, I get the message after hitting the undo
>> key sequence a couple of times.  Also, this works perfectly fine in
>> Emacs 21.2, as I mentioned in my initial report.
>
> In the key sequence you reported:
>
> ... C-k C-k C-k C-k C-k C-k C-k C-k C-k
> C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k C-k
> [snip]
> C-k C-k C-k C-k C-k C-k C-/ C-/ C-/ C-/ C-/ C-/ C-/
> C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/ C-/
> C-/ ESC x r e p o r t - e m a <tab> <return>
>
> it appears that you hit C-/ 22 times.  If Emacs kept 22 undo records,
> and each undo record takes about 1 kilobyte, that is enough to hit the
> default undo limit.  It might be that each undo record takes more space
> in Emacs 23 than in Emacs 21, which is why you don't see the problem in
> Emacs 21 (there are several reasons why this could happen, which could
> be investigated).
>
> I do observe the same behavior that you reported, using the key sequence
> you supplied; furthermore, if I increase undo-limit to a larger number,
> I find that Emacs can undo all the way back to the buffer's original
> state.

Chong Yidong <cyd <at> stupidchicken.com> writes:

> I've expanded the undo limits by a factor of four.  A more sophisticated
> fix, if one exists, will have to wait till after the release.

The undo limits were recently again doubled on master in commit
9466372 in relation to Bug#31104.  The latter change will be included
in the next major version of Emacs (version 27.1).

If you're still seeing this problem on a recent version of Emacs, a
workaround is to increase the values of the variables undo-limit,
undo-outer-limit and undo-strong-limit.  You could add something like
the following to your init file:

(setq undo-limit        (* 2 undo-limit))
(setq undo-outer-limit  (* 2 undo-outer-limit))
(setq undo-strong-limit (* 2 undo-strong-limit))

Of course, you could use a bigger number than 2 should that be necessary.

Given the discussion in Bug#31104, I'm not sure there's more to do
here.  But the discussion here also suggests that there have been an
increase in the memory usage of each undo record, especially when
using font-lock-mode.  I'm not sure that is a serious problem, since
memory is only getting cheaper, but it might be worth investigating.
On the other hand, we could just decide that this is not worth the
effort and close this as wontfix.

Thanks,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Tue, 20 Aug 2019 18:46:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org,
 Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Tue, 20 Aug 2019 14:45:08 -0400
Stefan Kangas <stefan <at> marxist.se> writes:

> increase in the memory usage of each undo record, especially when
> using font-lock-mode.  I'm not sure that is a serious problem, since
> memory is only getting cheaper, but it might be worth investigating.
> On the other hand, we could just decide that this is not worth the
> effort and close this as wontfix.

Hmm, it sounds like the problem might just be due to saving text
properties in the undo records?  If so, maybe a simple fix is to just
drop them (or drop only face and font-lock-face properties).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Wed, 21 Aug 2019 14:47:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org,
 Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Wed, 21 Aug 2019 16:46:26 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
> > increase in the memory usage of each undo record, especially when
> > using font-lock-mode.  I'm not sure that is a serious problem, since
> > memory is only getting cheaper, but it might be worth investigating.
> > On the other hand, we could just decide that this is not worth the
> > effort and close this as wontfix.
>
> Hmm, it sounds like the problem might just be due to saving text
> properties in the undo records?  If so, maybe a simple fix is to just
> drop them (or drop only face and font-lock-face properties).

Is it not worth saving also that information?

Thanks,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Thu, 22 Aug 2019 01:20:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org,
 Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Wed, 21 Aug 2019 21:19:32 -0400
Stefan Kangas <stefan <at> marxist.se> writes:

> Noam Postavsky <npostavs <at> gmail.com> writes:
>
>> Stefan Kangas <stefan <at> marxist.se> writes:
>>
>> > increase in the memory usage of each undo record, especially when
>> > using font-lock-mode.  I'm not sure that is a serious problem, since
>> > memory is only getting cheaper, but it might be worth investigating.
>> > On the other hand, we could just decide that this is not worth the
>> > effort and close this as wontfix.
>>
>> Hmm, it sounds like the problem might just be due to saving text
>> properties in the undo records?  If so, maybe a simple fix is to just
>> drop them (or drop only face and font-lock-face properties).
>
> Is it not worth saving also that information?

Definitely not face, since it's overwritten as soon as font-lock runs.
It's true font-lock-face can sometimes be set manually, though usually
it's computed by font-lock rules.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Wed, 20 Oct 2021 01:02:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org,
 Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Tue, 19 Oct 2021 18:01:43 -0700
[Message part 1 (text/plain, inline)]
tags 1501 + patch
thanks

Noam Postavsky <npostavs <at> gmail.com> writes:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
>> Noam Postavsky <npostavs <at> gmail.com> writes:
>>
>>> Stefan Kangas <stefan <at> marxist.se> writes:
>>>
>>> > increase in the memory usage of each undo record, especially when
>>> > using font-lock-mode.  I'm not sure that is a serious problem, since
>>> > memory is only getting cheaper, but it might be worth investigating.
>>> > On the other hand, we could just decide that this is not worth the
>>> > effort and close this as wontfix.
>>>
>>> Hmm, it sounds like the problem might just be due to saving text
>>> properties in the undo records?  If so, maybe a simple fix is to just
>>> drop them (or drop only face and font-lock-face properties).
>>
>> Is it not worth saving also that information?
>
> Definitely not face, since it's overwritten as soon as font-lock runs.
> It's true font-lock-face can sometimes be set manually, though usually
> it's computed by font-lock rules.

This would be fairly simple to do, as in the attached patch.  But I'm
not sure that we should make this change, since both `face' and
`font-lock-face' could be used by a major mode at various times, without
getting automatically re-added by font-lock.

From (info "(elisp) Precalculated Fontification"):

    But if the mode does not use the normal Font Lock machinery, it
    should not set the variable ‘font-lock-defaults’.  In this case the
    ‘face’ property will not be overridden, so using the ‘face’ property
    could work too.

IOW, I'm not sure that the proposed change won't introduce subtle bugs.

Other than that, we have doubled all undo limits in Emacs 27.1, so maybe
that's enough of a fix for now?

Any other opinions?
[0001-Decrease-size-of-undo-entries.patch (text/x-diff, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 20 Oct 2021 01:02:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Wed, 20 Oct 2021 12:07:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: emerick <at> gmail.com, 1501 <at> debbugs.gnu.org, cyd <at> stupidchicken.com,
 npostavs <at> gmail.com
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Wed, 20 Oct 2021 15:05:34 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Tue, 19 Oct 2021 18:01:43 -0700
> Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org,
>  Chong Yidong <cyd <at> stupidchicken.com>
> 
> +  /* Remove the `face' property to save space.  (Bug1501)  */
> +  if (!NILP (string))
> +    Fremove_list_of_text_properties (make_fixnum (0),
> +				     make_fixnum (SCHARS (string)),
> +				     CALLN (Flist, Qface),
> +				     string);

This modifies the text properties of STRING, which you don't own.

Also, it will do unnecessary non-trivial processing when undo is
turned off.

I definitely think that with the enlarged undo-limit we should leave
this obscure situation alone.  It isn't worth making such significant
low-level changes due to such obscure problems, which are arguably
cockpit errors.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1501; Package emacs. (Thu, 21 Oct 2021 20:47:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: emerick <at> gmail.com, 1501 <at> debbugs.gnu.org, cyd <at> stupidchicken.com,
 npostavs <at> gmail.com
Subject: Re: bug#1501: Emacs 22 loses undo buffer
Date: Thu, 21 Oct 2021 13:46:23 -0700
tags 1501 wontfix
close 1501
thanks

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Stefan Kangas <stefan <at> marxist.se>
>> Date: Tue, 19 Oct 2021 18:01:43 -0700
>> Cc: Emerick Rogul <emerick <at> gmail.com>, 1501 <at> debbugs.gnu.org,
>>  Chong Yidong <cyd <at> stupidchicken.com>
>>
>> +  /* Remove the `face' property to save space.  (Bug1501)  */
>> +  if (!NILP (string))
>> +    Fremove_list_of_text_properties (make_fixnum (0),
>> +				     make_fixnum (SCHARS (string)),
>> +				     CALLN (Flist, Qface),
>> +				     string);
>
> This modifies the text properties of STRING, which you don't own.
>
> Also, it will do unnecessary non-trivial processing when undo is
> turned off.
>
> I definitely think that with the enlarged undo-limit we should leave
> this obscure situation alone.  It isn't worth making such significant
> low-level changes due to such obscure problems, which are arguably
> cockpit errors.

OK, I'm therefore closing this bug as wontfix.

(Alternatively, we could just close it as "fixed" (with the doubling of
undo limits) but let's be a bit more explicit.)




Added tag(s) wontfix. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 21 Oct 2021 20:47:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 1501 <at> debbugs.gnu.org and "Emerick Rogul" <emerick <at> gmail.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 21 Oct 2021 20:47:03 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. (Fri, 19 Nov 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 157 days ago.

Previous Next


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