为什么 emacs 会为修改后的文件创建临时符号链接? [英] Why does emacs create temporary symbolic links for modified files?

查看:11
本文介绍了为什么 emacs 会为修改后的文件创建临时符号链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我修改缓冲区时,Emacs 会自动在与正在编辑的文件(例如 foo.c)相同的目录中创建一个临时符号链接:

.#foo.c ->user@host.12345:1296583136

其中12345"是 Emacs 的 PID(我不知道最后一个数字是什么意思).

Emacs 为什么要创建这些链接,我该如何防止它这样做?

请注意,我已关闭自动保存模式(Mx auto-save-mode)并禁用备份文件(Mx set-variable -> make-backup-files ->无).当我保存修改后的缓冲区或撤消对它的更改时,符号链接就会消失.

特别是,我试图阻止 Emacs 创建这些链接,因为它们会导致目录时间戳被修改,这会导致我们的构建系统重建整个模块,而不是为一个更改的文件编译和链接:/

感谢您的任何意见!

<小时>

更新:为了防止 Emacs 永久创建互锁文件,您可以更改 src/filelock.c 并构建自定义二进制文件:

void锁文件(fn)Lisp_Object fn;{返回;//下面未使用的代码...}

<小时>

更新 2:Arne 的回答是正确的.现在可以在最新的 Emacs (24.3.1) 中禁用锁定文件,方法是将其添加到您的 .emacs 文件中:

(setq create-lockfiles nil)

解决方案

更新:Emacs 24.3 已经发布,完全支持这个新设置!

在emacs的当前主干中,可以简单的自定义变量create-lockfiles:

C-h v create-lockfiles

文档:非零意味着使用锁文件来避免编辑冲突.

在你的init文件中,你可以设置

(setq create-lockfiles nil)

通过获取它

bzr 分支 bzr://bzr.savannah.gnu.org/emacs/trunk emacs-trunk制作源代码/emacs

(我发现了这个,因为我决定活跃起来,自己添加一个类似的选项...... :) )

When I modify a buffer, Emacs automatically creates a temporary symlink in the same directory as the file being edited (e.g. foo.c):

.#foo.c -> user@host.12345:1296583136

where '12345' is Emacs' PID (I don't know what the last number means).

Why does Emacs create these links, and how do I prevent it from doing that?

Note that I have turned off auto save mode (M-x auto-save-mode) and disabled backup files (M-x set-variable -> make-backup-files -> nil). When I save a modified buffer, or undo the changes to it, the symlink disappears.

In particular, I'm trying to prevent Emacs from creating these links because they cause the directory timestamp to be modified, which causes our build system to rebuild an entire module instead of compiling and linking for one changed file :/

Thanks for any input!


Update: In order to prevent Emacs from creating interlocking files permanently, you can change src/filelock.c and build a custom binary:

void
lock_file (fn)
     Lisp_Object fn;
{
     return;
     // Unused code below...
}


Update 2: Arne's answer is correct. It's now possible to disable lock files in the latest Emacs (24.3.1), by adding this to your .emacs file:

(setq create-lockfiles nil)

解决方案

Update: Emacs 24.3 has been released with full support for this new setting!

In the current trunk of emacs, you can simply customize the variable create-lockfiles:

C-h v create-lockfiles

Documentation: Non-nil means use lockfiles to avoid editing collisions.

In your init file, you can set

(setq create-lockfiles nil)

Get it via

bzr branch bzr://bzr.savannah.gnu.org/emacs/trunk emacs-trunk
make
src/emacs

(I found out about this, because I decided to get active and just add an option like that myself… :) )

这篇关于为什么 emacs 会为修改后的文件创建临时符号链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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