auto-save 파일을 어떻게 해야할까? 저장하지 말까?

less than 1 minute read

emacs는 파일을 열어 수정하면 auto-save 파일을 만든다. # 문자로 귀마개(earmuffs)를 씌운다. foo 파일을 수정하고 있으면 #foo# 파일을 만든다.

(setq auto-save-default nil)

auto-save 파일 생성을 막는다.

(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))

아니면 눈에 안 보이는 곳에 저장해서 여차하면 찾아볼 수 있는 여지를 남긴다. 마음의 평안을 얻는다.

파일을 아예 안 만드는 건 찝찝하다. 나도 tmp 디렉터리에 auto-save 파일을 만드는 설정을 추가하려고 했다.

I find that having the auto save file in the same directory useful for git because it helps remind me that I forgot to save the latest changes to a file before committing. - nil

남겨두는 게 리마인드에 도움이 된다는 댓글을 봤다. 맞다. 이런 효과가 있다. 저장 안 한 파일을 바로 알 수 있다. auto-save 파일은 수정한 버퍼를 저장하면 바로 삭제되기 때문이다. 특히 git staging area에 파일을 추가할 때, auto-save 파일이 눈에 띈다.

그래서 auto-save 파일 설정을 수정 안 하기로 했다.

\#*\#

.gitignore 파일에서 auto-save 파일을 무시하게 했는데, git status 명령어로 볼 수 있게 제거했다.

참고 - Keep Backup and Auto-save Files Out of the Way

C-x C-s C-x C-c