For a long time, I've wanted tab-completion in Emacs when programming in C, and haven't had the time to delve into ELisp enough to work out how to do it. However, thanks to the Emacs Wiki I now have it working!
I added the following to my .emacs file:
; Better tab completion (defun indent-or-complete () "Complete if point is at end of a word, otherwise indent line." (interactive) (if (looking-at "\\>") (dabbrev-expand nil) (indent-for-tab-command))) (add-hook 'c-mode-common-hook (function (lambda () (local-set-key (kbd "<tab>") 'indent-or-complete))))
And now it works very nicely indeed!
No comments:
Post a Comment