它实现了所需的行为:
(defadvice ac-inline-show (after eab-ac-expand activate)
(if (> (length ac-candidates) 1)
(let ((ac-common-part (try-completion ac-prefix ac-candidates)))
(ac-expand-common))
(progn
(ac-expand-string ac-common-part)
(ac-inline-hide)))
(setq eab-last-selected-candidate ac-selected-candidate))
对于停用:
(ad-remove-advice 'ac-inline-show 'after 'eab-ac-expand)
(ad-deactivate 'ac-inline-show)
编辑:
我尝试了工作流程并找到了一种取消错误书写的方法。作为示例,您打印lam
并扩展为,但您意外lambda
添加了额外内容并获取. 所以我设置bd
lambdabd
(global-set-key (kbd "C-<tab>") '(lambda () (interactive) (flet ((ac-candidates () `(,eab-last-selected-candidate))) (ac-fuzzy-complete)) (ac-expand)))
并使用它:lambdabd
变成lambda
,你可以像往常一样继续。
编辑2:
该解决方案有一个缺点:“它在模糊时会变慢一点”。它是通过缩小ac-candidates
到eab-last-selected-candidate
for来固定的ac-fuzzy-complete
。现在它很快!