Emacs:如何禁用“磁盘上的文件更改"检查? [英] Emacs: how to disable 'file changed on disk' checking?

查看:19
本文介绍了Emacs:如何禁用“磁盘上的文件更改"检查?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用 Emacs 检查缓冲区文件是否在编辑器外被更改?

How to disable Emacs from checking the buffer file was changed outside the editor?

推荐答案

Emacs 真的想在这里帮助你.阅读关于防止同时编辑的信息页面.

Emacs is really trying to help you here. Read the info page on Protection against Simultaneous Editing.

但是,如果您仍然想避免该消息/提示,您可以重新定义执行提示的函数:

But, if you still want to avoid that message/prompt, you can redefine the function that is doing the prompting:

(defun ask-user-about-supersession-threat (fn)
  "blatantly ignore files that changed on disk"
  )
(defun ask-user-about-lock (file opponent)
  "always grab lock"
   t)

当两个人使用 Emacs 编辑同一个文件时,第二个功能会提供类似的提示(但不是您在问题中似乎提到的那个).

The second function there is for when two people are using Emacs to edit the same file, and would provide a similar prompt (but not the one you seemed to refer to in the question).

我建议不要覆盖这两个例程,但如果您愿意,它就在那里.

I'd advise against overriding the two routines, but it's there if you want.

<小时>如果 global-auto-revert-mode 开启,您可以禁用它.将此添加到您的 .emacs:


On the off chance global-auto-revert-mode is on, you could disable that. Add this to your .emacs:

(global-auto-revert-mode -1)

你可以通过查看同名变量来判断模式是否开启:

You can tell if the mode is on by looking at the variable of the same name:

C-h v global-auto-revert-mode RET

如果值为t,则模式开启,否则关闭.

If the value is t, then the mode is on, otherwise it is off.

这篇关于Emacs:如何禁用“磁盘上的文件更改"检查?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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