当setting up autocomplete in Emacs irb(劣质红宝石模式)时,我遇到了一个无法仅将Ruby模式缓冲区添加为AC源的问题。我可以,例如。通过
添加当前目录中的文件(setq ac-sources '(ac-source-files-in-current-dir))
或者我可以通过
添加所有缓冲区(我最后采用了这些缓冲区)(setq ac-sources '(ac-source-words-in-all-buffer))
但我真正想要的只是添加 Ruby 模式缓冲区。 ^^
答案 0 :(得分:3)
期待ac-source-words-in-same-mode-buffers
...我们可以重复使用这种方法来构建我们自己的完成源,例如:
(ac-define-source words-in-ruby-buffers
'((init . ac-update-word-index)
(candidates . (ac-word-candidates
(lambda (buffer)
(eq (buffer-local-value 'major-mode buffer) 'ruby-mode))))))
将为我们提供ac-source-words-in-ruby-buffers
完成源。
P.S。我没有测试它,但它应该工作; - )