[置顶] emacs学习(四)

1.下载代码
1)获取autocomplete源码
  git clone https://github.com/auto-complete/auto-complete
2)获取popup-el源码,将popup.el拷贝到auto-complete目录下
  git clone https://github.com/auto-complete/popup-el
3)获取fuzzy-el源码将fuzzy.el拷贝到auto-complete目录下
  git clone https://github.com/auto-complete/fuzzy-el
4)获取增强列表源码
  从https://github.com/winterTTr/emacs-of-winterTTr/blob/master/.emacs.d/plugins/auto-complete-suite/pos-tip/pos-tip.el上拷贝源代码,保存在pos-tip目录下的pos-tip.el文件里

2.安装auto-complete
先说明一下,emacs是emacs24,auto-complete、pos-tip、fuzzy-el和popup-el目录在~/emacs-plugin下

1)编译auto-complete
1'进入auto-complete目录
2'make
3'配置emacs,在~/.emacs文件里增加以下内容
(add-to-list 'load-path "~/emacs-plugin/pos-tip")
(add-to-list 'load-path "~/emacs-plugin/fuzzy-el")
(add-to-list 'load-path "~/emacs-plugin/popup-el")
(add-to-list 'load-path "~/emacs-plugin/auto-complete")

(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories
             "~/emacs-plugin/auto-complete/dict")
(ac-config-default)

(require 'pos-tip)
(setq ac-quick-help-prefer-pos-tip t)   ;default is t

(setq ac-fuzzy-enable t)

说明一下,第一段代码添加代码路径到emacs启动路径中,第二段代码将字典加入auto-complete字典路径,第三段代码使用pos-tip代替auto-complete默认的弹出菜单,第四段代码启动模糊匹配功能

ps:由于我是要使用emacs编辑javascript程序,还需要额外做点工作
   cd ~/emacs-plugin/auto-complete/dict
   ln -s javascript-mode js-mode
  这是由于emacs里模式别名问题

auto-complete模式可以正常使用了(tab键自动补全),惭愧啊,emacs以前没有弄过搞了半天才弄好


你可能感兴趣的:(emacs,emacs,auto-complete安装)