watch - Watch a file
watch monitors a file on the file system by periodically polling the file and reacquiring the contents into a buffer. The command is typically used to monitor build and logging files as their output changes under control of a background process. Any number of files may be watched simultaneously, however to minimize the number of file system transfers, only those buffers that are being viewed in a window are updated.
watch operates in three different modes:-
Mode 1 (Reload)
Mode 2 (Reload, Append)
Mode 3 (Append)
The operational mode may be selected by passing a numeric value of 1, 2 or 3 to the watch command. If no numeric argument is provided then the user is prompted for the operational mode.
Whilst running in an append mode (2 or 3) then byte offset of the end of the file is retained for the next read. On the next read then any new information from the last saved byte offset to the end of the file is read, irrespective of any edits made to the buffer. Therefore if the buffer contents have been deleted on the next append read then the buffer will contain the appended information only and not reacquire the information that has been deleted. Where the complete buffer is to be re-acquired then use Mode 1.
The buffer mode line is modified to show the watch state. i.e.
==W <buffer-name> ==============
Invocation of watch in a buffer that is being watched disables the watch. All watches may be removed from all buffers using 0 watch-reset.
watch-time modifies the poll time of a watch. The user is prompted for the time period which is entered in seconds.
watch-reset re-evaluates the watches that are on the buffers reporting the number of files that are bing watched. When invoked with a 0 argument then any outstanding watch commands are removed.
watch is a macro implemented in watch.emf.
The commands watch-reset and watch-time are not available until a watch command has been executed.
watch was developed in 2000 and appeared in MicroEmacs releases after this date however the comand was not exported to the user. The watch command was fully integrated in the 2005 release.
Copyright (c) 1998-2006 JASSPA
Last Modified: 2006/08/13
Generated On: 2006/10/07