I confirm that...
What is your question?When using magit with a tramp/ssh connection to a remote host, I get a lot of files with a pattern similar to:
which seems to contain a copy of files with changes not yet commited. These files are still present even after commiting changes ending up cluttering the repository. It seems like I have to remove these files manually. This is of course just a minor annoyance and I could limit it by adding those to my It has been a bit hard for me to try to find anything related to this issue as this doesn't seem to be related to where tramp stores temporary files (they are in I also don't know if this is actually related to doom emacs but I haven't done any special configuration so this is just magit+tramp "out of the box" with doom emacs. Any way to avoid having to clean up these files would be appreciated as well as pointers to where I might find more information. Thanks a lot. System informationhttps://gist.github.com/laudrup/33ea96dc60a335316967ca26d0956ba4 |
Replies: 4 comments 12 replies
|
I think this is a bug in Doom. I noticed it a while ago and fixed it in my private config, but I never got around to reporting it to Doom. Does adding the following to your config.el fix the issue? ;; in $DOOMDIR/config.el
(setq tramp-auto-save-directory "~/.cache/doom/tramp-autosave/")
(after! doom-editor
;; TODO: PR or issue
(defadvice! doom-make-hashed-auto-save-file-name-a (fn)
"Compress the auto-save file name so paths don't get too long."
:around #'make-auto-save-file-name
(let ((buffer-file-name
(if (or
;; Don't do anything for non-file-visiting buffers. Names
;; generated for those are short enough already.
(null buffer-file-name)
;; If an alternate handler exists for this path, bow out. Most of
;; them end up calling `make-auto-save-file-name' again anyway, so
;; we still achieve this advice's ultimate goal.
(find-file-name-handler buffer-file-name
'make-auto-save-file-name))
buffer-file-name
;;CHANGED
(concat (or (and (string-match-p "/tramp-autosave/" buffer-file-name)
(file-name-directory buffer-file-name))
"")
(sha1 buffer-file-name)))))
(funcall fn)))) |
|
The tramp defaults were moved to a new The quick fix is to enable Otherwise, a much simpler version of AjaKN's fix: (setq tramp-auto-save-directory (concat doom-cache-dir "tramp-autosave/")
tramp-backup-directory-alist backup-directory-alist)In any case, I'll move these two variables back to Doom core soon so the module isn't required for these files. |
|
Prefixing TRAMP auto save files goes all the way back to doomemacs/core@9bbdacc, but it’s not really necessary. You can check But setting You should be able to drop ;; Write all auto-save files to the same directory as session auto-save
;; lists. Hash filenames to avoid any filesystem name length
;; limitations. ‘tramp-auto-save-directory’ bypasses the hash transform,
;; so leave it unset.
(setq auto-save-file-name-transforms `((".*" ,auto-save-list-file-prefix sha1)))TRAMP autosave files won’t have a special prefix, but prefixing an opaque hash isn’t that useful anyway. The actual mappings from file names to autosave file names can be found in the autosave list files in the same |
Ah, forgot to post here. Yesterday, with the help of someone on Discord, I was able to reproduce the issue and discovered the cause of it. I pushed a fix a short while ago: doomemacs/core@8f31710
Update Doom and let me know if the issue persists after that.