-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No further undo information #12110
Comments
The last comment in this issue:
Here's some more info about the variable:
source: emacs-evil/evil#1074 (comment) I haven't read all of the links from those issues, but I noticed this comment: #774 (comment)
It might also be something to test. |
Yeah I did find that issue and set the variable to nil, but I don't think it fixed it for me. I still feel I hit the limit too early, but at this point it's all just empirical observation, I don't have any proof that it was better and now it has gotten worse. |
undo-propose seems to be nice, maybe even better than undo-tree but I'm afraid the latter is lodged in Spacemacs ecosystem and it wouldn't be very straightforward to replace one package with another, I might be wrong though. |
There seems to be a newer version |
yuhan0 suggested a method for getting the latest version of undo-tree: #9903 (comment) And it works, I just replacing the undo-tree package listing in: with:
then I moved the current Now undo-tree.el shows:
the old one showed:
and the latest changelog entry at the bottom: ;; 2013-12-28 Toby S. Cubitt tsc25@cantab.net |
I am still having this annoying issue. Can someone publish a guide how to remove undo-tree from Spacemacs completely and maybe replace it with something that actually works. |
I have same issue. |
Proposed workaround - put the following line in
This will disable undo-tree mode and it will fallback to native emacs undo-redo functionality. Source - http://ergoemacs.org/emacs/emacs_best_redo_mode.html |
Disabling undo-tree mode as in the message above does not resolve the problem. History is still lost, although perhaps not quite as much as with undo-tree-mode |
This thing is utterly annoying. Can someone please suggest a workaround? Undo is one of the most important features of any editor and I it is clearly broken right now in Spacemacs. I don't understand how is it not the most pressing issue at the moment? |
Reproduction steps to encounter the issue: Copy this snippet: (dotimes (_ 30)
(insert "Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.")
(fill-paragraph))
(nil
(" " . -14546)
(14545 . 14546)
(" " . -14466) ... (" " . -93)
(" " . -55)
(" " . -24)
(1 . 500))
Reproduced in both Ubuntu 18.04.02 and Windows 10 Version 1803. System Info 💻
(emacs-lisp git helm markdown multiple-cursors org spell-checking treemacs version-control)
System Info 💻
(autohotkey emacs-lisp git helm javascript markdown multiple-cursors org spell-checking syntax-checking treemacs version-control)
|
@duianto's comment is the first report I've seen of this widely-reported issue that includes steps to reproduce. Unfortunately, I can't reproduce with vanilla undo-tree (i.e. not using Spacemacs). Following the equivalent of @duianto's steps in vanilla Emacs+undo-tree results for me in an undo tree containing two nodes, one the empty buffer, the other the buffer with all the text inserted, as expected. Undo/redo worked perfectly. I believe Spacemacs adds extra undo boundaries compared to vanilla Emacs (can someone confirm?). So I tried running this modified snippet:
No luck. This produced a linear undo tree containing 31 nodes, as expected. Undo/redo still worked perfectly. Can anyone find steps to reproduce this issue without Spacemacs? If they could, I might finally be able to make some headway with figuring out this bug! If not, it could indicate the issue is to do with how Spacemacs integrates undo-tree, rather than with the undo-tree package per se. -- Toby (undo-tree author+maintainer) |
When agzam posted the link to the reddit thread, that talks about that it could be a garbage collection issue. Then I messaged the spacemacs maintainers about it, and syl20bnr responded:
|
I seem to be able to reproduce the issue without Spacemacs, by starting Emacs without any configurations and only installing With the Spacemacs
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(dotimes (_ 30)
(insert "Aliquam erat volutpat. Nunc eleifend leo vitae magna. In id erat non orci commodo lobortis. Proin neque massa, cursus ut, gravida ut, lobortis eget, lacus. Sed diam. Praesent fermentum tempor tellus. Nullam tempus. Mauris ac felis vel velit tristique imperdiet. Donec at pede. Etiam vel neque nec dui dignissim bibendum. Vivamus id enim. Phasellus neque orci, porta a, aliquet quis, semper a, massa. Phasellus purus. Pellentesque tristique imperdiet tortor. Nam euismod tellus id erat.")
(fill-paragraph))
... switching back to the test buffer
System infoGNU Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13 Also reproduced with: |
@duianto Thanks! I can reproduce this using your recipe. But this appears to be undo-tree behaving as expected. The undo history is longer than undo-limit (and probably also one or more of the other limits, undo-strong-limit or undo-outer-limit). So emacs GC discards the oldest part of the undo history, which in this case consists of the insertion of "a". You can see exactly the same behaviour (i.e. just "a" left in the buffer and the "No further undo information" message) witthout undo-tree-mode, using vanilla emacs undo. If you increase the values of undo-limit, undo-outer-limit, and undo-strong-limit you'll see you can undo all the way back to an empty buffer (both with vanilla undo, and with undo-tree). |
Thanks for the clarification. Then we're back to Spacemacs being to aggressive with garbage collection as syl20bnr said. |
Indeed. It definitely seems like garbage collection is involved here. Depending on when GC kicks in, the history may get discarded before undo-tree sees it, or it may get incorporated into the tree. Undo-tree does its own history discarding when it gets too big. But because the way it stores the undo history is (sometimes) more efficient than vanilla emacs undo, it might sometimes keep more history than vanilla undo. Spacemacs triggering GC more frequently would likely lead more often to emacs discarding undo history before undo-tree sees it. So that might explain why people seem to see this effect more often with Spacemacs. But none of this is a bug. This is all intentional behaviour both of undo-tree and vanilla emacs undo. As documented in the manual, you can keep more undo history around by increasing the values of undo-limit, undo-strong-limit and undo-outer-limit. It would be nice to think this misunderstanding of how emacs discards undo history explains all the reports of "No further undo information" with undo-tree. But I'm not sure. I need more recipes like yours that reproduce the observed behavour, before I can investigate and determine whether it's expected or not. |
@duianto @tsc25 I can't appreciate you enough for going above and beyond to get to the bottom of this. I guess we can soon expect aforementioned vars to be tweaked in Spacemacs core, in the meantime, what would be the best defaults in your opinion? Can you provide struggling and disappointed users (such myself) with the instructions? Thank you! |
@agzam It's as much thanks to @duianto for putting in the hard work of finding a reproducible recipe. The Emacs defaults for undo-limit etc. are (rightly) quite conservative: the defaults keep only ~80kb of undo history. On modern machines with plenty of RAM, it's probably safe to increase this substantially (though don't blame me if you start swapping :) You can use Read the docstrings to understand the differences between these three settings. Basically, you'll want to set I'm not yet 100% convinced these settings are the whole story behind the issue of undo-tree losing history. But if the issue seems to goes away by increasing these settings for Spacemacs users, then I'll start to believe there was never any bug, and it was just the interaction between Spacemacs, GC and undo-tree happening to trigger more frequent undo history cleanup. |
It might not be a garbage collection issue. There's a variable called
I set the dotspacemacs-gc-cons '(1000000000 0.1) And replicated the steps. undo still shows Update:It's a to limited test. With regular use one will perform helm/ivy searches, spell/syntax check, etc., any of which could trigger garbage collection. So it's probably difficult to rule it out as a source. |
I increased the variable limit as suggested by @tsc25, by a factor of 10 and so far I havent lost any history (after several hours) or had the annoying no more history. I will see what happens over the next day or so. In the
|
@jr0cket That's great, thanks for testing. Spacemacs uses the default Emacs values. Because they are the same without Spacemacs: If it works then I'm sure they can be increased in Spacemacs. |
Another possible solution might be to double the dotspacemacs-gc-cons '(200000000 0.1) This was suggested by an Emacs maintainer in this thread: https://www.reddit.com/r/emacs/comments/bg85qm/garbage_collector_magic_hack/eln27qh/ |
Increasing GC is one of the opportunities Emacs uses to check |
I pushed the settings from @jr0cket to the develop branch. |
I am reporting success. I haven't seen 'no further undo' for a while. First I've been using the custom settings, and 10 days ago I updated spacemacs from the develop branch. |
I'm reporting success too, I encountered it very easily before the new settings. |
I'm sure this is an upstream issue, I'm posting it here hoping someone would shed a light to it
I use evil and undo things in NORMAL mode pressing
u
(nothing unusual).I have noticed that lately, I'm hitting the point where it simply says
No further undo information
and the stuff is simply lost. It's not in undo-tree either. I know, there are various vars likeundo-limit
that can be tweaked, but I haven't changed anything in my config. And it seems lately I'm hitting the limit fairly often - like I'd make about 10-20 changes, try to undo and bam! see the message, which is very frustrating and strange.Does anyone else have the same problem?
The text was updated successfully, but these errors were encountered: