问题如何指定一个用户的emacs init文件来加载emacsclient?
如何指定一个用户的emacs init文件来加载emacsclient?
emacsclient不理解'-u用户'和'-ALTERNATE-EDITOR'不允许我引用它并提供'-u用户'。
例如,运行:
/usr/bin/emacsclient -n -a '/usr/bin/emacs -u <username>' ~<username>/notes.txt
回报
/usr/bin/emacsclient: error executing alternate editor "/usr/bin/emacs -u <username>"
背景
我使用emacs版本23.1.1和emacsclient版本23.1。
emacs本身支持'-u user'加载指定用户的init文件。
我用我的别名下面的bash函数文件来调用emacs的
# a wrapper is needed to sandwich multiple command line arguments in bash
# 2>/dev/null hides
# "emacsclient: can't find socket; have you started the server?"
emacs_wrapper() {
if [ 0 -eq $# ]
then
/usr/bin/emacsclient -n -a /usr/bin/emacs ~<username>/notes.txt 2>/dev/null &
else
/usr/bin/emacsclient -n -a /usr/bin/emacs $* 2>/dev/null &
fi
}
alias x='emacs_wrapper'
打字X,接着文件的列表:
- 如果正在运行连接到现有的emacs的服务器,否则开始一个新的
- 作为后台进程执行
- 如果没有提供文件,打开文件或笔记文件列表
当我以我自己的身份登录时,此功能非常有用。但是,许多生产箱需要我作为生产用户登录。我已经将我的别名分隔成一个bash脚本,因此我可以通过简单的运行来获得我的别名和bash函数。
. ~<username>/alias.sh
不幸的是,这会不会让我用我的.emacs文件(〜<用户名> /.emacs):(
这个问题已经快把我逼疯了。
谢谢;这很好用! – vlee 2011-04-12 21:56:03