.gitignore emacs临时文件的正则表达式 [英] .gitignore regex for emacs temporary files

查看:219
本文介绍了.gitignore emacs临时文件的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图.gitignore emacs临时/自动保存文件。我正在使用...

  \.\#。* 

在我的.gitignore中。



但是 git add -A 在子文件夹中运行仍然给我:

 #new file:。#make_collections.py 
#new file:。#norm_collections.py
#new file:make_collections.py
#new file:norm_collections.py

即使

  \.\#。* 

显然是正确的文件名而不是错误的文件名,当我进行测试。 您也可以指示emacs保存自动保存文件通过设置变量 auto-save-file-name-transforms 完全在不同的目录中,我在init文件中有这个

 (setq auto-save-file-name-transforms 
`((。*,(concat user -emacs-directoryauto-save /)t)))

这指示emacs存储自动保存在user-emacs-directory的 auto-save 文件夹中(通常为〜/ .emacs.d )。

要将备份文件保存在其他目录中,请设置变量 backup-directory-alist ,以下内容将会将备份文件保存在user-emacs-directory的备份文件夹中 (setq backup-directory-alist
`((。。 ,(expand-file-name
(concat user-emacs-directorybackups)))))


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

\.\#.*

in my .gitignore.

But git add -A run in a subfolder is still giving me:

#       new file:   .#make_collections.py
#       new file:   .#norm_collections.py
#       new file:   make_collections.py
#       new file:   norm_collections.py

even though

\.\#.*

is clearly getting the right file names and not the wrong ones when I test it with a regex tester.

解决方案

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")))))

这篇关于.gitignore emacs临时文件的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆