简体   繁体   English

如何从Erlang escript调用Emacs?

[英]How to invoke Emacs from an Erlang escript?

Inspired by Git as when you type "git commit", it opens an Emacs or Vim session for you. 受Git的启发,当您输入“git commit”时,它会为您打开Emacs或Vim会话。 I'm writing an Erlang escript, and I want it to open an Emacs session at the end of the execution of the escript. 我正在写一个Erlang escript,我希望它在escript执行结束时打开一个Emacs会话。 I've tried 我试过了

os:cmd("emacs -nw file.txt")

but it doesn't seem to work. 但它似乎没有用。 Evaluating the above command within the Erlang shell yields 在Erlang shell中评估上面的命令会产生

"emacs: standard input is not a tty\n"

One way to do this is to keep an Emacs running with server mode (put (server-mode) in your ~/.emacs ), and call emacsclient instead of emacs from Erlang. 一种方法是使Emacs以服务器模式运行(将(server-mode)放在~/.emacs ),并从Erlang调用emacsclient而不是emacs That will open the file in the existing Emacs session. 这将在现有的Emacs会话中打开该文件。 emacsclient exits and returns control to your Erlang program once you hit Cx # in Emacs. 一旦你在Emacs中点击Cx #emacsclient退出并将控制返回给你的Erlang程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM