gpt4 book ai didi

emacs - 从 Emacs 运行程序,不要等待输出

转载 作者:行者123 更新时间:2023-12-04 13:28:49 24 4
gpt4 key购买 nike

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

(shell-command (concat "start sumatrapdf " (shell-quote-argument path) " -page " search))))

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

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

最佳答案

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.

如果您不想将缓冲区与开放进程相关联 — 通过 nil作为 BUFFER 参数

关于emacs - 从 Emacs 运行程序,不要等待输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7298372/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com