emacs - 在 emacs lisp 中启动进程,该进程在 lisp 程序结束后继续

标签 emacs elisp

如何在 emacs lisp 中启动一个在 emacs lisp 程序结束后继续运行的进程?我正在编写一个实用程序脚本,该脚本应该启动交互式 GUI 程序并退出。

提前致谢。

编辑:我想我正在寻找与此 C++ 代码等效的 emacs lisp。

#include <cstdlib>
#include <sys/types.h>
#include <unistd.h>

int main() {
    using namespace std;

    pid_t p = fork();
    if (p == 0) {
        // child process
        execl("process_to_run", "process_to_run", nullptr);
    } else {
        // stuff for parent to do
    }

    return 0;
}

最佳答案

它可能无法完全回答您的问题,但以下包使一些内容与您想要的非常相似:https://bitbucket.org/jpkotta/openwith/overview

它基本上使用外部程序(例如 okular、gimp...)打开一个文件,并且

"wraps commands in nohup on Unix so launched processes will not exit if Emacs exits."

我不知道它的实现细节,但你可以尝试阅读他们的代码。对我有用。

关于emacs - 在 emacs lisp 中启动进程,该进程在 lisp 程序结束后继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11252061/

相关文章:

emacs - 在 Emacs lisp 中检查一个字符串是否全部大写?

emacs - emacs 中 Groovy 风格方法参数的缩进

file - 如何在emacs中写入文件

vim - 在 emacs evil 中搜索视觉选择

macos - Home/end 控制字符在 Mac OS X 终端下的 emacs 中不起作用

emacs - 学习 Emacs 的资源

emacs - GNU Emacs 中的前段

linux - 当需要用户输入时,Emacs --batch 在 cron 中运行会挂起吗?

go - Emacs 编译忽略编译命令变量

emacs - Emacs 中的眼镜模式