5

Is there a way to run a shell command, have the output show up in a new buffer and have that output show up incrementally? Eshell and other emacs terminal emulators do a find job of this but I see no way to script them.

What I'd like to do is write little elisp functions to do stuff like run unit tests, etc. and watch the output trickle into a buffer.

The elisp function shell-command is close to what I want but it shows all the output at once when the process finishes.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
darrint
  • 418
  • 4
  • 8
  • 3
    Not quite what you need, but `M-x compile` shows compilation progress incrementally. –  Apr 24 '10 at 21:17

2 Answers2

4

As doublep mentioned, there is M-x compile, and there's also just the simple M-x shell and in that shell you run whatever you want.

Community
  • 1
  • 1
Trey Jackson
  • 73,529
  • 11
  • 197
  • 229
1

You can also use comint-run to execute a command without needing to start a sub-shell first. I believe M-x shell uses comint mode with some modifications, so this won't be a whole lot different from that. But if you want to call a program directly and have its input and output be tied to a buffer, comint-run is the function to call. It is a little tricky to use, so read the documentation: C-h f comint-run.

A. Levy
  • 29,056
  • 6
  • 39
  • 56