Fix #4993: shorten long file names for caches

Emacs generates long file names for auto-save and backup files.
undo-fu-session and tramp are two more big offenders. This fix SHA1s
their file names so they never exceed 40 characters.

Will also affect any package that uses make-backup-file-name-1
directly (like undo-tree).
This commit is contained in:
Henrik Lissner 2021-05-06 14:33:08 -04:00
parent a98c2ece63
commit 9831642a02
2 changed files with 35 additions and 0 deletions

View file

@ -31,6 +31,11 @@
(setq undo-fu-session-directory (concat doom-cache-dir "undo-fu-session/")
undo-fu-session-incompatible-files '("\\.gpg$" "/COMMIT_EDITMSG\\'" "/git-rebase-todo\\'"))
;; HACK Fix #4993: prevent file names that are too long for the filesystem.
;; TODO PR this upstream; should be a universal issue
(advice-add #'undo-fu-session--make-file-name
:filter-args #'doom-make-hashed-backup-file-name-a)
;; HACK We avoid `:config' here because `use-package's `:after' complicates
;; the load order of a package's `:config' block and makes it impossible
;; for the user to override its settings with merely `after!' (or