サイトマップ 更新履歴 ニュース Elispセクション 利用手引

TopMode

top-mode.el can run the Unix program “top” from Emacs.

You can find it here: Lisp:top-mode.el

Nice mode, but lacks many features: face highliting (runnable tasks, own tasks, etc), choosing signal which to kill with, list of files opened by process (like in htop). – IvanKorotkov

Installation

Load it with autoload or require. The enter

 M-x top-mode

or load it permanently with

 (top-mode 1)

in your emacs configuration file.

Usage

Press g to run top and q to quit. Other features are:

Autorefresh

If you want this to auto-refresh like the shell’s top, you might add the following to your .emacs. It binds the A key in top-mode to an interactive function. Set the refresh rate in seconds, and turn off by setting the refresh rate to 0.

Note that a refresh rate of 1 is not recommended, as the top function moves point to top’s buffer. This leaves little time to render the prompt and let the user change the refresh rate in the minibuffer.

It would be nice if top updated its buffer without moving point, so you could have top in one buffer and work in another.

 (defun top-auto-refresh (rate)
   (interactive "nTop refresh rate (seconds): ")
   (progn
     (cancel-function-timers 'top)
     (if (not (zerop rate))
         (setq *top-refresh-timer* 
               (run-with-timer 2 rate 'top)))))
 (define-key top-mode-map "A" 'top-auto-refresh)

Use with Anything

Anything is a candidate selection framework.

Start with ‘M-x anything-top’, narrow the top output by typing some patterns(multiple patterns are space-delimited string), select with up/down/pgup/pgdown/C-p/C-n/C-v/M-v, Enter to kill.

C-z kills selected process without quitting anything session.

Etop by Tom Wurgler

Lisp:etop.el provides command M-x etop to display top(1) output.


CategoryModes | CategoryExternalUtilities