如何让Emacs运行程序而不等待输出/响应?我试图在一个外部程序中打开一个pdf:
(shell-command (concat "start sumatrapdf " (shell-quote-argument path) " -page " search))))但是,在现有的sumatrapdf进程关闭之前,它不会打开其他文件。我尝试了async-shell-command,但是它打开了一个不需要异步输出的新缓冲区。
在外部程序中打开文件的正确方法是什么?
发布于 2011-09-04 09:56:31
start-process函数可以处理以下问题:
(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作为缓冲区参数进行关联。
发布于 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将立即将控制权还给您。
https://stackoverflow.com/questions/7298372
复制相似问题