Emacs and Long Shell Commands

牧云@^-^@ 提交于 2019-12-07 07:43:33

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/2706171/emacs-and-long-shell-commands

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!