A minor mode is not enabled/disabled by setting a variable. The minor mode variable should be used to check the "mode enabled" status, not to set the mode state. If its value is t
, the minor mode is on, else the mode is off.
See the below snippets to see how to control any minor mode. Replace MINOR-MODE-NAME
with the actual minor mode name you are dealing with (global-auto-revert-name
as is the case in the question).
Enabling a minor mode
Using elisp
Directly
(MINOR-MODE-NAME)
;; or
(MINOR-MODE-NAME 1)
Based on a hook activation
(add-hook 'SOME-HOOK #'MINOR-MODE-NAME)
Disabling a minor mode
Using elisp
Directly
(MINOR-MODE-NAME 0)
;; or
(MINOR-MODE-NAME -1)
Based on a hook activation
(add-hook 'SOME-HOOK (lambda () (MINOR-MODE-NAME -1)))
Toggling a minor mode
Interactively
M-x MINOR-MODE-NAME
Using a key binding
(global-set-key (kbd "<KEY>") #'MINOR-MODE-NAME)
Using elisp (non-interactively)
(MINOR-MODE-NAME 'toggle)
Sources
(global-auto-revert-mode 1)
– Kaushal Modi Apr 27 '15 at 17:38auto-revert-interval
? I use it and it works for me, excepting files over tramp. – Swarnendu Biswas Apr 27 '15 at 17:55emacs -Q
session? Open a file (somefile.txt) in an emacs 24.3 instance with -Q option. DoM-x global-auto-revert-mode
. From terminal, echo some string (echo 1234 >> somefile.txt
). Please let us know if somefile.txt still does not auto revert. – Kaushal Modi Apr 27 '15 at 18:22auto-revert
works as intended. However, it looks like it uses the older timer system (auto-revert-use-notify
is nil) and not the newer file notification system. – Lindydancer Apr 27 '15 at 20:37auto-revert-use-notify
tonil
(the default value ist
). – Kaushal Modi Apr 27 '15 at 20:45auto-revert-use-notify
tonil
on your emacs setup under OSX? Does it work if set tot
? – Kaushal Modi Apr 27 '15 at 20:55t
, it's reset tonil
onceglobal-auto-revert-mode
is enabled. (It looks likeauto-revert-notify-add-watch
use the timer-based system as a fall-back when it fails to add a notification watch.) – Lindydancer Apr 27 '15 at 21:03