|
|

楼主 |
发表于 2006-8-19 17:49:58
|
显示全部楼层
Post by pluskid
恩,加进 .Xresources 之后确实没有崩溃了,不过不能使用 X 对于我来说好像是很不方便的。把代码注释掉之后也好了,不过这确实不是解决办法,你的英语好,你去报告到邮件列表吧
看来作者对于这个问题是不是不好 Reproduce ,好像邮件列表里面的邮件也没
有人回复。不过现在不用 emacs multi-tty 也可以做到几乎相同的功能了,是
配合 Sawfish 使用的,不过我想只要是有类似于 Sawfish 里面的那个
jump-or-exec 的扩展并且可以通过命令行进行控制的窗口管理器都好轻松实现
这个功能吧。我在 Sawfish 里面是这样做的:
首先配置 Sawfish 的 jump-or-exec :
- (defun jump-or-exec-emacs ()
- (interactive)
- (jump-or-exec "emacs@" ; Emacs's title
- (lambda () ; When Emacs isn't running
- (system "emacs &"))
- (lambda (wind) ; When already focused
- (display-window wind))))
- (bind-keys global-keymap
- "H-e" 'jump-or-exec-emacs)
复制代码
然后写一个脚本来调用 emacsclient :
- #!/bin/sh
- # first jump-or-exec to emacs
- sawfish-client -c jump-or-exec-emacs
- # then call emacsclient
- emacsclient "$@"
复制代码
不过这样并不能满足要求,因为 Emacs 的启动需要几秒钟的时间,如果事
先没有启动 Emacs ,就调用 e ,则 sawfis-client -c
jump-or-exec-emacs 立即返回,这个时候 Emacs 还没有完全启动起来并执
行 (server-start) ,所以 emacsclient 这个时候会抱怨找不到 server
。没关系,我们修改一下代码,如果 Emacs 没有启动起来,就 sleep 几
秒,在 sawfish 里面 sleep 当然不好,所以将作为一个返回值传回脚本
,并由脚本来 sleep 。下面是修改后的 jump-or-exec-emacs 函数:
- (defun jump-or-exec-emacs ()
- (interactive)
- (jump-or-exec "emacs@" ; Emacs's title
- (lambda () ; When Emacs isn't running
- (system "emacs &")
- "sleep 3")
- (lambda (wind) ; When already focused
- (display-window wind))))
复制代码
并将启动脚本改为:
- #!/bin/bash
- # first jump-or-exec to emacs
- cmd=`sawfish-client -e '(jump-or-exec-emacs)'`
- if [ "()" != "$cmd" ]
- then
- # () stands for nil in lisp, if it is not (), then
- # it should be the cmd returned by jump-or-exec-emacs
- # to be invoked. See ~/.sawfishrc for more information
- #
- # $cmd
- # simply $cmd won't work, because $cmd is "some cmd"
- # with the quote mark, so I have to filter the quote
- # mark first
- cmd=${cmd%"}
- cmd=${cmd#"}
- $cmd
- fi
- # if there's argument then call emacsclient
- if [ $# -gt 0 ]
- then
- emacsclient "$@"
- fi
复制代码
其中, jump-or-exec-emacs 里面的秒数可以根据自己 Emacs 的启动速度
来设定,这样是不是非常方便了?然后把这个脚本命名为 e ,再把 EDITOR 变
量设置为 e 就OK啦! |
|