[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Sat, 06 Dec 2003 18:31:40 +0100
hmm, does emacs have something like this already?
example usage: M-x watch RET pstree RET 2 RET
;;; ID: $Id: watch.el,v 1.1 2003/11/12 15:47:52 ttn Exp $
;;; Copyright (C) 2003 Thien-Thi Nguyen
;;; This file is part of ttn's personal elisp library, released under GNU
;;; GPL with ABSOLUTELY NO WARRANTY. See the file COPYING for details.
;;; Description: Run a shell command periodically, displaying output.
(defun watch (command slackfulness)
"Execute shell COMMAND every SLACKFULNESS seconds, displaying output.
Type any key to stop command execution (the key is passed to Emacs)."
(interactive "sShell Command: \nnSeconds between redisplay: ")
(format "watch (%d sec): %s" slackfulness command)))
(while (not stop)
(shell-command (concat "date;" command) (current-buffer))
(setq stop (not (eq t (sit-for slackfulness))))))
(rename-buffer (format "(watch stopped): %s" command)))
;;; $RCSfile: watch.el,v $$Revision: 1.1 $ ends here
|[Prev in Thread]
||[Next in Thread]|
Thien-Thi Nguyen <=