.gitignore regex for emacs temporary files

前端 未结 6 1531
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 06:11

I\'m trying to .gitignore emacs temporary/autosave files. I\'m using...

\\.\\#.*

in my .gitignore.

But git add -A run in

6条回答
  •  -上瘾入骨i
    2021-02-05 06:46

    You can also instruct emacs to save the autosave files in a different directory altogether by setting the variable auto-save-file-name-transforms, I have this in my init file

    (setq auto-save-file-name-transforms
              `((".*" ,(concat user-emacs-directory "auto-save/") t))) 
    

    This instructs emacs to store the auto-saves inside the auto-save folder in the user-emacs-directory (usually ~/.emacs.d).

    To save backup files in a different directory set the variable backup-directory-alist, the following will save backup files inside backups folder in the user-emacs-directory

    (setq backup-directory-alist
          `(("." . ,(expand-file-name
                     (concat user-emacs-directory "backups")))))
    

提交回复
热议问题