[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11. Reverting Buffers

Whenever a file that Emacs is editing has been changed by another program the user normally has to execute the command ‘revert-buffer’ to load the new content of the file into Emacs.

This package is defined in autorevert.el and contains two minor modes: Global Auto-Revert Mode and Auto-Revert Mode. Both modes automatically revert buffers whenever the corresponding files have been changed on disk.

Auto-Revert Mode can be activated for individual buffers. Global Auto-Revert Mode applies to all file buffers.

Both modes operate by checking the time stamp of all files at intervals of ‘auto-revert-interval’. The default is every five seconds. The check is aborted whenever the user actually uses Emacs. You should never even notice that this package is active (except that your buffers will be reverted, of course).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.1 Auto-Revert Usage

To configure the package, type:

 
  M-x customize-group RET auto-revert RET

To activate Auto-Revert for a specific buffer, go to the buffer and type:

 
  M-x auto-revert-mode RET

To activate Global Auto-Revert Mode, type:

 
  M-x global-auto-revert-mode RET

To activate Global Auto-Revert Mode every time Emacs is started customize the option ‘global-auto-revert-mode’ or the following line could be added to your initialization file:

 
  (global-auto-revert-mode 1)

The function ‘turn-on-auto-revert-mode’ could be added to any major mode hook to activate Auto-Revert Mode for all buffers in that mode. For example, the following line will activate Auto-Revert Mode in all C mode buffers:

 
  (add-hook 'c-mode-hook 'turn-on-auto-revert-mode)

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.