watch.el
The watch.el package repeatedly runs a command, displaying the output in an Emacs buffer. Unlike the Unix watch command, it offers additional features:
- Pause, resume, and immediately refresh the output.
- Updates are temporarily paused while selecting text.
- Adjust the refresh interval without restarting.
- Supports ANSI escape sequences.
Installation
Use Package VC
projects/watch-el/index.md:26:```elisp
projects/watch-el/index.md:32:```elisp
projects/watch-el/index.md:39:```elisp
projects/watch-el/index.md:74:```elisp
(use-package watch
:vc (:url "https://github.com/Stebalien/watch.el"))
Elpaca
Directly:
(elpaca (watch :host github :repo "Stebalien/watch.el"))
Or with use-package:
(use-package
:ensure (watch :host github :repo "Stebalien/watch.el"))
Straight
(use-package watch
:straight (watch :type git :host github :repo "Stebalien/watch.el"))
Usage
M-x watch RET <command> RET
You’ll be prompted for a command to watch and an interval between updates (default: 2 seconds).
Key Bindings
In a watch buffer:
| Key | Description |
q | Quit the watch buffer |
g | Refresh immediately |
i | Change the update interval |
p | Toggle pause/resume |
Status Indicators
The header line shows the current status of the watch buffer:
<P>- Paused<R>- Running (command is executing)<S>- Sleeping (between command runs)<!>- Failed (command exited with non-zero status)
Customization
You can customize the various status indicators:
(setopt watch-paused-indicator "[PAUSED]"
watch-running-indicator "[RUNNING]"
watch-sleeping-indicator "[SLEEPING]"
watch-failed-indicator "[FAILED]")
For a complete list of options, run M-x customize-group RET watch RET.