3

Emacs 26.3 Linux Mint 19.3

I work with my Google drive. I want to disable auto reverting mode for remote files. Is it possible?

a_subscriber
  • 3,854
  • 1
  • 17
  • 47

2 Answers2

7

Set auto-revert-remote-files to nil. This disables auto reverting for all files with Tramp syntax.

If you want to disable auto reverting of remote files in a mounted directory, or in a sync directory, add that directory name to auto-revert-notify-exclude-dir-regexp.

Michael Albinus
  • 6,647
  • 14
  • 20
  • Somehow I missed `auto-revert-remote-files` :) I did see `auto-revert-notify-exclude-dir-regexp` but from the name that seemed like it should only affect reverts driven by filesystem notification systems, and therefore not affect auto-revert polling? – phils Mar 17 '20 at 23:09
  • That's true, `auto-revert-notify-exclude-dir-regexp` disables file notifications. But you can combine it with `auto-revert-avoid-polling`. Both set proper, you'll get only file notifications for local file systems, and nothing else. – Michael Albinus Mar 18 '20 at 08:43
3

You could use C-hv global-auto-revert-ignore-buffer with C-hv find-file-hook

(defun my-inhibit-remote-auto-revert ()
  "Used in `find-file-hook'."
  (when (file-remote-p buffer-file-name)
    (setq global-auto-revert-ignore-buffer t)))

(add-hook 'find-file-hook #'my-inhibit-remote-auto-revert)
phils
  • 48,657
  • 3
  • 76
  • 115
  • I'll leave this answer here in case the approach helps someone for a different scenario, but the answer by @MichaelAlbinus is unquestionably the way to go for this question. – phils Mar 17 '20 at 23:05