emacs 右键菜单

2145阅读 0评论2012-01-14 weikent
分类:WINDOWS

Emacs是个非常强大的文本编辑器,不仅开源而且免费。可是下载下来的Windows版Emacs没有安装包,使用时需要到先打开Emacs再打开要编辑的文本文件,感觉不太方便。相信很多人一定希望能把Emacs像Editplus一样集成到Windows右键,点击一个文件选择“使用Emacs打开”,那样多方便啊。

没关系,我们可以自己DIY,将Emacs集成到Windows右键只是小case,只需几步就搞定。

一、新建一个文本文件,将后缀名改为.reg。

二、将下面文字写入文件中(当然,路径神马的得先更新一下)

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]
[HKEY_CLASSES_ROOT\*\shell\openwemacs]
@=”&Edit with Emacs”
[HKEY_CLASSES_ROOT\*\shell\openwemacs\command]
@=”Absolute\\Path\\to\\your\\emacs\\bin\\runemacs.exe \”%1\”"
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs]
@=”Edit &with Emacs”
[HKEY_CLASSES_ROOT\Directory\shell\openwemacs\command]
@=”Absolute\\Path\\to\\your\\emacs\\bin\\runemacs.exe \”%1\”"

三、双击.reg文件导入注册表。




注册表文件可以写成如下

[HKEY_CLASSES_ROOT\*\Shell\Open With Emacs\command] @="D:\\emacs-23.3\\bin\\emacsclientw.exe %0"

而且必须添加两个环境变量:
EMACS_SERVER_FILE 与 ALTERNATE_EDITOR环境变量
EMACS_SERVER_FILE = d:\emacs\home\.emacs.d\server\server
ALTERNATE_EDITOR = d:\emacs\bin\runemacs.exe

HOME = d:\emacs\home (微软整路径空格干dan用啊)


(server-start) ;;
(add-hook 'kill-emacs-hook ;;
(lambda() ;;
(if (file-exists-p "~/.emacs.d/server/server") ;;
(delete-file "~/.emacs.d/server/server")))) ;;



参考:

上一篇:How To Fix iBooks Crashing Issue On Jailbroken iOS 5:
下一篇:对字符串的操作(加密、解密、过来、生成缩略图、过滤非法字符)