我最近开始在启动时以守护进程模式运行emacs。通过GUI客户端(Emacs.app)连接似乎能正确加载自定义设置。但是,通过终端连接
第一个症状出现在尝试在终端中使用
在研究问题和可能的解决方案后,我无法确定处理此问题的绝对可靠的方法。我看到了建议创建不同的init文件和相应的bash别名,每次想要在终端中打开emacs缓冲区时将其传递给
非常感谢您提供的建议、批评和技巧。
编辑添加:
* GNU Emacs 24.3.1
* emacsclient 24.3
* 在OS X 10.9上都使用homebrew安装
这是LaunchAgent:
这里是点文件配置:
有时我也喜欢在tmux内启动emacs:
emacsclient
却不行。第一个症状出现在尝试在终端中使用
M-x customize-variable
时,会产生以下消息:
这可能与Cannot save customizations: init file was not fully loaded
emacs --daemon
忽略所有与X11相关的选项根据此处有关。虽然在我的情况下看起来,emacsclient没有加载后续选项。在研究问题和可能的解决方案后,我无法确定处理此问题的绝对可靠的方法。我看到了建议创建不同的init文件和相应的bash别名,每次想要在终端中打开emacs缓冲区时将其传递给
emacsclient --eval
。我也看到其他人在主init文件中使用if-else语句来处理与X11相关的选项。但在走向任何一条路之前,我想知道是否有一种标准的处理方法,我是否遗漏了什么(或者我只是在某个地方犯了错误)。非常感谢您提供的建议、批评和技巧。
编辑添加:
* GNU Emacs 24.3.1
* emacsclient 24.3
* 在OS X 10.9上都使用homebrew安装
这是LaunchAgent:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>emacsdaemon</string>
<key>ProgramArguments</key>
<array>
<string>/opt/boxen/homebrew/bin/emacs</string>
<string>--daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Emacs Daemon</string>
<key>UserName</key>
<string>my_name</string>
</dict>
</plist>
这里是点文件配置:
# relevant lines of .zshrc:
alias emacs="/opt/boxen/homebrew/bin/emacsclient -nw"
# set emacsclient as default editor
export EDITOR="emacsclient"
# use only emacscilent
export ALTERNATE_EDITOR=""
有时我也喜欢在tmux内启动emacs:
# relevant lines of .tmux.conf:
# open emacs inside of tmux in a new window
# hat tip: http://perlstalker.vuser.org/blog/2012/10/16/emacsclient-and-tmux/
bind-key y new-window -n "emacs" "/opt/boxen/homebrew/bin/emacsclient -nw"