在linux脚本中打开emacs的server模式怎么写?

因为要经常打开好几个emacs窗口,而在.emacs里添加(server-start)代码,后面的emacs窗口就会出错误了。 所以想建一个脚本,自动启动emacs,并自动开启server-start模式。这样一个emacs窗口运行在server模式下,后面的emacs窗口用普通的就好了。

$ emacs --daemon,参考手册:[(emacs) Emacs Server] (Emacs Server (GNU Emacs Manual))。

推荐一个用法,会在没有 server 时自动启动 server emacsclient -a "" -s workspaceN

开机时,在.xinitrc.xprofile里添加 emacs --daemon=workspaceN &

之后需要client打开时就用前面的用法,要用emacs打开就直接用emacs, workspace的目的是防止emacs偶尔启动server时冲突(如 auctex-mode 里的 zathura 预览)

多谢楼上两位,太给力了!!