Enable auto-complete via TAB in most modes through a defadvice

This commit is contained in:
2012-08-25 12:51:35 +03:00
parent 9ec98d1e9f
commit 49c56e603f
2 changed files with 14 additions and 0 deletions

View File

@@ -60,3 +60,10 @@
(xterm-mouse-mode 1)
(global-set-key [mouse-4] 'scroll-down-line)
(global-set-key [mouse-5] 'scroll-up-line))
;; Auto-complete when indenting.
(defadvice indent-for-tab-command (around ac-before-indent activate)
"Call `auto-complete' if text was recently entered"
(if (ac-trigger-command-p last-command)
(auto-complete)
ad-do-it))

View File

@@ -71,6 +71,13 @@
(ruby-indent-line t)
(end-of-line))
;; Auto-complete when indenting
(defadvice ruby-indent-command (around ac-before-ruby-indent activate)
"Call `auto-complete' if text was recently entered"
(if (ac-trigger-command-p last-command)
(auto-complete)
ad-do-it))
;; Yasnippet workaround for ruby-electric-mode
;; See: http://code.google.com/p/yasnippet/issues/detail?id=71
(defun yas/advise-indent-function (function-symbol)