首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从Emacs运行一个程序,不要等待输出

从Emacs运行一个程序,不要等待输出
EN

Stack Overflow用户
提问于 2011-09-04 09:45:20
回答 2查看 2.6K关注 0票数 9

如何让Emacs运行程序而不等待输出/响应?我试图在一个外部程序中打开一个pdf:

代码语言:javascript
复制
(shell-command (concat "start sumatrapdf " (shell-quote-argument path) " -page " search))))

但是,在现有的sumatrapdf进程关闭之前,它不会打开其他文件。我尝试了async-shell-command,但是它打开了一个不需要异步输出的新缓冲区。

在外部程序中打开文件的正确方法是什么?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-09-04 09:56:31

start-process函数可以处理以下问题:

代码语言:javascript
复制
(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)

Start a program in a subprocess.  Return the process object for it.
NAME is name for process.  It is modified if necessary to make it unique.
BUFFER is the buffer (or buffer name) to associate with the process.

Process output (both standard output and standard error streams) goes
at end of BUFFER, unless you specify an output stream or filter
function to handle the output.  BUFFER may also be nil, meaning that
this process is not associated with any buffer.

PROGRAM is the program file name.  It is searched for in `exec-path'
(which see).  If nil, just associate a pty with the buffer.  Remaining
arguments are strings to give program as arguments.

If you want to separate standard output from standard error, invoke
the command through a shell and redirect one of them using the shell
syntax.

如果不希望将bufer与开放进程传递nil作为缓冲区参数进行关联。

票数 14
EN

Stack Overflow用户

发布于 2011-09-04 17:37:17

请参阅C-h k M-!

...如果命令以符号结尾,则异步执行它。输出出现在缓冲区‘`Async命令’中。该缓冲区处于shell模式。..。

IOW,M-! my_command --opt=foo arg1 arg2 &将启动my_command并创建一个运行my_command*Async Shell Command*缓冲区,但emacs将立即将控制权还给您。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7298372

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档