2

I have plenty of files opened in my emacs daemon. In the background there is a running process which make changes on the *.yaml files that are already opened in my emacs. I am using auto-revert-mode in order to automatically reverts the buffer when its visited file changes on disk.

But when changes made, I keep seeing following warning message: Reverting buffer ‘<filename>.yaml’. Would it be possible to prevent this message showing up?


setup:

(global-auto-revert-mode 1)
(setq auto-revert-use-notify nil)
(defun revert-buffer-no-confirm ()
    "Revert buffer without confirmation."
    (interactive)
    (revert-buffer :ignore-auto :noconfirm))
Drew
  • 75,699
  • 9
  • 109
  • 225
alper
  • 1,238
  • 11
  • 30
  • 2
    You might want to try: `(setq auto-revert-verbose nil)` The default value is non-nil and it is defined within `autorevert.el` – lawlist Sep 24 '21 at 12:50
  • When I did `(setq auto-revert-verbose nil)`, I am seeing `assignment to free variable ‘auto-revert-verbose’` message (would it be a problem?) but seems like it solved the problem. – alper Sep 24 '21 at 12:55
  • I normally only see such a message if I am byte-compiling ... what are you doing when you see that "assignment to free variable" message? – lawlist Sep 24 '21 at 13:00
  • Just when I was editing into `.emacs` file it shown in the minibuffer, if I bring cursor on top of `auto-revert-verbose` – alper Sep 24 '21 at 13:20
  • A barebones installation of Emacs does not behave like that out of the box with no user-configuration. You may wish to consider loading the `autorevert` library before setting the relevant variable discussed above. – lawlist Sep 24 '21 at 13:26
  • how could I load `autorevert` library? using `(require autorevert.el)`? – alper Sep 24 '21 at 13:33
  • I don't know anything about mouse-over tool-tip interaction when hovering over a variable, but one way to load a library is with `(require 'autorevert)` – lawlist Sep 24 '21 at 13:36
  • 1
    Does this answer your question? [Is it possible to suppress \`Fill column set to 80 (was 80)\` message in the echo area?](https://emacs.stackexchange.com/questions/63825/is-it-possible-to-suppress-fill-column-set-to-80-was-80-message-in-the-echo) – Drew Sep 24 '21 at 19:15
  • There are multiple similar questions. Search for tag `[inhibit-message]`. – Drew Sep 24 '21 at 19:16
  • @Drew `(setq auto-revert-verbose nil)` answered my question. I am not sure how could I merge `auto-revert` with `inhibit-message` solution , since there is no `mode-hook` for `auto-revert.el`. – alper Sep 25 '21 at 11:03
  • Although setting `auto-revert-verbose` to `nil` is definitely the preferred solution in this case, you *could* do it by finding out which function emits the message (in this case , `auto-revert-handler`) and wrapping that function in a `(let ((inhibit-message nil) ...)` probably using `advice`. – NickD Sep 25 '21 at 13:31
  • @NickD -- I was thinking of let-binding `auto-revert-verbose` around the O.P.'s usage of `revert-buffer` ... like this: `(let ((auto-revert-verbose nil)) (revert-buffer :ignore-auto :noconfirm))` – lawlist Sep 25 '21 at 16:39
  • 1
    @lawlist your comment solved this problem for me too. It'd be nice if you made it into an answer. Very useful. Thank you! – pglpm Jul 11 '23 at 14:00

0 Answers0