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?

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.

2
  • 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 8: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)
1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.