reddit / emacs

Undo-tree BUG: "*.~undo-tree~" files scattering everywhere!

yep808 · 2022-03-15 07:57
Has anyone encountered the bug where you suddenly see a bunch of \*.\~undo-tree\~ hidden files scattering everywhere? (Whenever I undo an edit in a file, a new file gets created with the same file name except with .\~undo-tree\~ file extension appended to it.) I'm not exactly sure what happened since this morning -- it was working fine then. I reinstalled Emacs and nuked the elpa packages and reinstalled them all, but the problem is still here. I've never seen this behavior before. Any help would be appreciated!
adouzzy · 2022-03-15 09:00
Undo Fu is an alternative.
[deleted] · 2022-03-15 15:09
[removed]
Heavy-Onyx · 2022-03-15 16:17
Might be, but here it is easier to customize undo-tree-auto-save-history to nil. The default for that variable has changed in the latest release on Sunday.
yep808 · 2022-03-15 16:21
I'm sorry you got downvoted. I didn't know undo-fu existed -- thanks for letting me know!
yep808 · 2022-03-15 16:21
I've tried so hard to find the changelog, thanks for pointing out the variable change -- it must be the reason. Where did you find the undo-tree changelog?
Heavy-Onyx · 2022-03-15 16:27
I just looked at the latest diffs in git. Luckily it was the first change in the file. https://git.savannah.gnu.org/gitweb/?p=emacs/elpa.git;a=blobdiff;f=undo-tree.el;h=1b8eb2f8d44005a3a9d88d5b3fdbf352d48a1d14;hp=e3785877b1a9e3038309c20cef4bb0385e3ec03c;hb=71718650961b8546a3cba311c6cc8e069c85e882;hpb=bf2e9ba0c97e38e2037ff1bd01b81c15471110fd
[deleted] · 2022-03-15 21:16
[deleted]
ideasman_42 · 2022-03-15 22:47
If you want auto-saved undo history [undo-fu-session](https://gitlab.com/ideasman42/emacs-undo-fu-session) - no dependencies on undo-fu, they can be used together though. Undo history is stored in a directory and wont scatter files around your repository.
jcs090218 · 2022-03-16 08:13
Do `(setq undo-tree-auto-save-history nil)`
[deleted] · 2022-03-16 22:52
[deleted]
[deleted] · 2022-03-17 01:29
[deleted]
char1zard4 · 2022-03-19 13:09
I saw the same behavior change, just set the auto-save-history variable to nil to regain the old behavior. It looks like a feature update instead of a bug, allows undo-tree to preserve history after emacs closes
qubitcoder · 2022-03-23 16:19
I recently encountered this behavior using Spacemacs (Emacs 28.0.60). A bit annoying considering that it kept clobbering up my git working tree. Here's what worked for me. I added the following to `~/.spacemacs` within `dotspacemacs/user-config`. ;; Prevent undo tree files from polluting your git repo (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))) That will persist the undo history in `~/.emacs.d/undo` instead of locally. In case it helps anyone, here's how to quickly find and delete all undo files: # Search the `app` directory recursively for any files containing '~undo' # Then interactively preview each command, and confirm with y/n $ find app -print | grep '~undo' | xargs -p -I {} rm {} rm app/.!app!models!customer.rb.~undo-tree~?... y ... ...
TyrionBean · 2022-08-21 07:34
Thank you. That line saving files to \~/.emacs.d/undo is perfect. Much obliged. 👍
AnthonyD973 · 2022-11-02 21:03
Awesome! [It works](https://github.com/AnthonyD973/ademacs/commit/33773d5f6243c11629590ff3019063ccbf326f93)! BTW I think a better delete command (which, however, would not prompt for deletion) is: ``` cd <the dir to delete undo-tree files recursively in> find -type f -name '*.~undo-tree~' -delete ```