-
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
Persistent undo #774
Comments
Yes, you can do it by setting undo-tree-auto-save-history variable to true. You can also save/load manually with undo-tree-save-history and undo-tree-load-history. |
The temp directory is |
@tuhdo That's what I'm looking for, thank you 🍻 @syl20bnr Thanks, that's good to know. I just saw #298. I've added this (setq undo-tree-auto-save-history t
undo-tree-history-directory-alist
`(("." . ,(concat spacemacs-cache-directory "undo"))))
(unless (file-exists-p (concat spacemacs-cache-directory "undo"))
(make-directory (concat spacemacs-cache-directory "undo"))) (which is the reverse of 885d092) to my Let's leave this issue open for a while to see if I get corrupted history or not. If everything works well for a week or two, I'll close it. |
Great ! Thank you for testing this. |
@syl20bnr No worries, thank you for spacemacs :) |
@syl20bnr It's been 10 days and I haven't had any issues so far. Although I use emacs regularly, I haven't spent hours editing one single file to see if the history goes corrupt or not. So, that's the last thing I'll try to test this: Soon I'll have to write a lab report. I use emacs for editing TeX, and writing the report would at least take a good couple of hours, so that's my last shot of trying to get a corrupt undo tree. |
Any news on this ? |
@syl20bnr I haven't had any undo history corruptions. I think it's safe to add the feature back, or at least make it an option (disabled by default) that one can set in |
Maybe my issue might be related. If you make a change somewhere, save it, and make a change, then save again, then move your cursor. Press then |
That's a nice update on this issue. Thank you ! 👍 |
Any news on this, @aminb? |
@ReneFroger When I did |
So it causes a bug. Then it cannot be included in Spacemacs, until we get a update from the authors of Evil, I guess. |
Fair enough :) |
FWIW, @ReneFroger's bug may not be caused by this alone, as I'm seeing the bug without this customization. |
I added @aminb's change and I have been getting a corrupt undo tree message periodically, so as far as I can tell it is still a problem unfortunately. Optionally we could add it back as an optional flag in the init file? I have a hunch that it only happens in some major modes, but I don't really have any evidence for that hunch. |
Did you work on a source controlled repo ? |
That is very possible. I don't think I ever write text or code in a non git or perforce backed directory, so that could be the issue. |
Interesting, I'm not sure if the error happened only when I was at work but it happens that I'm using perforce too. |
I don't use perforce or another source controlled repo. Is there any way to get persistent undo and last-changes working? |
What about undohist? I just try it, very nice! But i don't know if i will encounter corruptions like in undotree... |
Are you sure that the undo's are persistent after closing and starting Emacs? I tested it, and it didn't worked for me. I use Windows by the way. |
They aren't currently. You need to manually enable it to get the functionality. Sent from my Windows Phone From: ReneFrogermailto:notifications@github.com Are you sure that the undo's are persistent after closing and starting Emacs? I tested it, and it didn't worked for me. I use Windows by the way. — |
Yes, it is. I use it with desktop-save-mode. |
I would really love to see reliable persistent undo in spacemacs. In vim a few times it saved me when I messed up a file and could find a version from hours ago after having closed and opened it multiple times in between. Until this bug is hunted down though, I am afraid of enabling the auto-save-history flag after reading this thread here. |
Unfortunately, github doesn't have issue voting, but in the meantime I believe giving the original post here a "thumbs up" reaction is the way to go (issues can be sorted by the number of reactions received). |
Undo-tree's auto-saving was working fine for me until I began building emacs from the master development repo. I downgraded to a recent third-party build from master and my seemingly broken
(I am not sure what produced the back-tick on the final line) |
You can simplify tests in your environment by setting a few command-line options:
Example:
|
I noticed that a user named @razzius made a little layer for persistent undo in his personal config, based on I'll continue using it for a while and report back. If we could hear from @razzius about the tool's functionality and stability (since it has been in his config for about a year now), that would be awesome too. It looks like we haven't heard anything from @CestDiego since the submission of his undohist PR, either. |
@therealpxc It works fine but honestly I restart emacs so infrequently it isn't all that useful to me. Back when I used Vim I would open a new editor every few minutes but in Emacs I keep a single editor server running for days at a time. There was 1 time when undo glitched but I'm not even sure that was due to undohist. The other potential downside is dozens of messages about the undo history being discarded due to the file digest not matching on startup, and I presume it's adding to my (already slow) Emacs startup time. undohist is functional and seems to be the de facto way to persist undo history in Emacs so I think it's a neat feature that could be added but disabled by default. |
Lawlist has been working on an undo-tree fork. |
Have you or anyone else successfully integrated this w/ spacemacs? I still don't actually know the proper way to replace a package with a fork. |
I suspect it is or will be https://github.com/emacscollective/borg, but I have yet to try it (I know very little about git submodules) edit: and/or possibly https://github.com/raxod502/straight.el (like borg, also fairly inchoate)? huge README, but perhaps this section is also relevant: https://github.com/raxod502/straight.el#comparison-to-borg |
I tried Borg for a while, but updating across the board was not possible afaict. |
@sooheon Try NB to @braham-snyder: indeed, @aaronjensen I would assume the correct way to integrate this into Spacemacs is to use Quelpa as that's what Spacemacs uses for its package management. But you could also try |
@raxod502 Haven't given straight.el a run yet, but I admire your code documenting philosophy ;) |
just want to see if there is any update on this? persistent undo is a huge issue for me! thanks! |
Which version are you running, @diego898 ? |
Im running:
and I have the following in my
|
Same here, would love to see any update. |
A new package https://github.com/jackkamm/undo-propose-el has been released and claims to be safer to use than |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
See http://www.dr-qubit.org/Lost_undo-tree_history.html for further details. |
@notbandali Thank you so much. Solved my problem. |
There's a PR to evil that (hopefully) fixes the issue but it's stalled unfortunately: emacs-evil/evil#1430 |
emacs-evil/evil#1430 got merged in the meantime, so this could be tested again. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
In vim, I can use something like this
in my vimrc and have my undo history preserved. So, for instance if I make some changes and save and close vim. If later on I change my mind, I can open vim again, open the file and just undo (
u
) whatever I had done.Using spacemacs, if I exit emacs, my undo history will be gone; meaning the next time I open emacs and open the file, pressing
u
does nothing.Is there a way to have the undo history preserved, across launches?
The text was updated successfully, but these errors were encountered: