简体   繁体   中英

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. I'm writing an Erlang escript, and I want it to open an Emacs session at the end of the execution of the escript. 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

"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. That will open the file in the existing Emacs session. emacsclient exits and returns control to your Erlang program once you hit Cx # in Emacs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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