;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Autocomplete
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defadvice cperl-indent-command
(around cperl-indent-or-complete)
"Changes \\[cperl-indent-command] so it autocompletes when at the en
+d of a word."
(if (looking-at "\\>")
(dabbrev-expand nil)
ad-do-it))
(defun cperl-dabbrev-installer ()
(set (make-local-variable 'dabbrev-case-fold-search) nil)
(set (make-local-variable 'dabbrev-case-replace) nil))
(eval-after-load "cperl-mode"
'(progn
(require 'dabbrev)
(ad-activate 'cperl-indent-command)
(add-hook 'cperl-mode-hook #'cperl-dabbrev-installer)))
| [reply] [d/l] |
Okay. The Eclipse fanboys will say that doesn't complete methods and such since it's just textual, but dabbrev works well in practice, and is a wonderful thing for all kinds of documents. btw, one nice trick I use for indent-or-complete commands is to complete on the second "TAB" when the line hasn't moved, rather than when at end-of-word, like so (pseudocode):
(defun my-indent-or-complete ()
(interactive)
(let ((pos (point)))
(indent-command)
(when (and (= pos (point))
(eq last-command 'my-indent-or-complete))
(complete-command))))
| [reply] [d/l] |
| [reply] [d/l] |