我想让我的 .bashrc 检测运行 emacsclient 是否可以代替运行 emacs。基本上:
if emacs_server_is_running; then
EDITOR=emacsclient
VISUAL=emacsclient
else
EDITOR=emacs
VISUAL=emacs
fi
我应该在 emacs_server_is_running
函数中放入什么来实现这个目标?
最佳答案
你太难了。来自 emacsclient(1)
手册页:
-a, --alternate-editor=EDITOR if the Emacs server is not running, run the specified editor instead. This can also be specified via the `ALTERNATE_EDITOR' environment variable. If the value of EDITOR is the empty string, then Emacs is started in daemon mode and emacsclient will try to connect to it.
关于shell - 我怎样才能检测到 emacs-server 正在从 shell 提示符运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1510481/