Jürgen Hötzel has a nice post on solving a problem many of us have. Suppose you start a long running process—a make, say—from Eshell and then go on to do other work. It’s easy to lose track of the process because the original buffer may be buried and nothing might happen for a long time. Hötzel wants to be notified when the process completes or if it terminates abnormally.
It turns out to be absurdly easy to do that by leveraging John Wiegley’s alert package. Hötzel has the alert set up to show in the minibuffer but the alert package supports many different styles of alerts. For example, if you’re a Mac user and have Growl installed, you can send the alert to Growl. Another nice feature of the alert package is that you can add rules to filter the alerts. For example, Hötzel added a rule to not display the alert if the original buffer is visible. That helps cut down on noise.
Hötzel triggers his alerts by hooking into the eshell-kill-hook
but it’s easy to see how you could generate many other types of alerts either by using other hooks. Take a look at Hötzel’s code; it’s very minimal and simple and mostly decides whether the alert should have “normal” status (when the process terminate normally) or “urgent” status (when the process terminates abnormally).