shiroghost · 2022-08-13 12:01
Hi all,
After some package update, my HD has started to fill with `.~undo-tree~` files. I cannot find in the documentation of the package a way to tell undo-tree to put all the files in a directory (like the usual emacs \~ files).
Does anyone has a solution?
Thanks!
[deleted] · 2022-08-13 12:06
[removed]
wasabichicken · 2022-08-13 12:17
I found this in [the source](https://gitlab.com/tsc25/undo-tree/-/blob/master/undo-tree.el#L944):
>By default, undo-tree history is saved to a file called ".<buffer-file-name>.\~undo-tree\~" in the same directory as the file itself. To save under a different directory, customize \`undo-tree-history-directory-alist' (see the documentation for that variable for details).
and then:
>(defcustom undo-tree-history-directory-alist nil "Alist of filename patterns and undo history directory names. Each element looks like (REGEXP . DIRECTORY). Undo history for files with names matching REGEXP will be saved in DIRECTORY. DIRECTORY may be relative or absolute. If it is absolute, so that all matching files are backed up into the same directory, the file names in this directory will be the full name of the file backed up with all directory separators changed to \`!' to prevent clashes. This will not work correctly if your filesystem truncates the resulting name.
>
>For the common case of all backups going into one directory, the alist should contain a single element pairing "." with the appropriate directory name.
>
>If this variable is nil, or it fails to match a filename, the backup is made in the original file's directory.
>
>On MS-DOS filesystems without long names this variable is always ignored."
I hope it can be useful for you.
Illiamen · 2022-08-14 16:35
In addition to the Undo Tree settings mentioned by others, see this package, which configures those settings for many packages:
https://github.com/emacscollective/no-littering