Tre*_*son 18
Emacs真的很想帮助你.阅读有关防止同时编辑的信息页面.
但是,如果您仍想避免该消息/提示,则可以重新定义正在执行提示的函数:
(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)
Run Code Online (Sandbox Code Playgroud)
第二个功能是当两个人使用Emacs编辑同一个文件时,会提供类似的提示(但不是你似乎在问题中引用的提示).
我建议不要覆盖这两个例程,但是如果你想要它就在那里.
global-auto-revert-mode,您可以禁用它.将其添加到.emacs:
(global-auto-revert-mode -1)
Run Code Online (Sandbox Code Playgroud)
您可以通过查看同名变量来判断模式是否已打开:
C-h v global-auto-revert-mode RET
Run Code Online (Sandbox Code Playgroud)
如果值为t,则模式打开,否则关闭.
dou*_*lep 10
我有以下内容.emacs.它使Emacs只询问真正改变的文件.如果文件按字节保持相同,则只更新其时间戳,就像在VCS中切换分支时经常发生的那样,Emacs会忽略此"更改".
;; Ignore modification-time-only changes in files, i.e. ones that
;; don't really change the contents. This happens often with
;; switching between different VC buffers.
(defun update-buffer-modtime-if-byte-identical ()
(let* ((size (buffer-size))
(byte-size (position-bytes size))
(filename buffer-file-name))
(when (and byte-size (<= size 1000000))
(let* ((attributes (file-attributes filename))
(file-size (nth 7 attributes)))
(when (and file-size
(= file-size byte-size)
(string= (buffer-substring-no-properties 1 (1+ size))
(with-temp-buffer
(insert-file-contents filename)
(buffer-string))))
(set-visited-file-modtime (nth 5 attributes))
t)))))
(defun verify-visited-file-modtime--ignore-byte-identical (original &optional buffer)
(or (funcall original buffer)
(with-current-buffer buffer
(update-buffer-modtime-if-byte-identical))))
(advice-add 'verify-visited-file-modtime :around #'verify-visited-file-modtime--ignore-byte-identical)
(defun ask-user-about-supersession-threat--ignore-byte-identical (original &rest arguments)
(unless (update-buffer-modtime-if-byte-identical)
(apply original arguments)))
(advice-add 'ask-user-about-supersession-threat :around #'ask-user-about-supersession-threat--ignore-byte-identical)
Run Code Online (Sandbox Code Playgroud)
就我而言,我想要:
(setq revert-without-query '(".*"))
Run Code Online (Sandbox Code Playgroud)
文档revert-without-query:
Specify which files should be reverted without query.
The value is a list of regular expressions.
If the file name matches one of these regular expressions,
then ‘revert-buffer’ reverts the file without querying
if the file has changed on disk and you have not edited the buffer.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8078 次 |
| 最近记录: |