Emacs - connect to daemon (if it exists) without using emacsclient

孤街浪徒 提交于 2019-12-10 19:13:50

问题


If I have emacs running as a daemon on my system, I can connect to it easily using emacsclient. This I know. However, what I would like to know is, is there a way to tell emacs (not emacsclient) to behave like emacsclient if a daemon is already running?

e.g.

# emacs daemon is not running
emacs # should start a new frame

# ...

# emacs daemon IS running
emacs # should actually behave like emacsclient, i.e. connect to my daemon

Is there anything I can do to my init.el to replicate this kind of behaviour?


回答1:


I don't think so, but can you achieve a similar effect by using emacsclient with an empty string as the the --alternate-editor option? From http://www.gnu.org/s/libtool/manual/emacs/emacsclient-Options.html#emacsclient-Options:

-a command

--alternate-editor=command

. . . As a special exception, if command is the empty string, then emacsclient starts Emacs in daemon mode and then tries connecting again.



来源:https://stackoverflow.com/questions/8328469/emacs-connect-to-daemon-if-it-exists-without-using-emacsclient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!