[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs C++ auto code completion problem
From: |
Alan Mackenzie |
Subject: |
Re: emacs C++ auto code completion problem |
Date: |
Tue, 26 May 2009 18:30:07 +0000 |
User-agent: |
Mutt/1.5.9i |
Hi, Richard!
On Tue, May 26, 2009 at 05:55:18PM +0200, Richard Riley wrote:
> GMS S <gmspro@yahoo.com> writes:
> Did you read
> http://xtalk.msk.su/~ott/en/writings/emacs-devenv/EmacsCedet.html ?
> Specifically
> ,----
> | (defun my-c-mode-cedet-hook ()
> | (local-set-key "." 'semantic-complete-self-insert)
> | (local-set-key ">" 'semantic-complete-self-insert)) <=========
> | (add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
> `----
Please don't do this! In some CC Modes (C++ Mode, Java Mode, ...), ">"
is bound to `c-electric-lt-gt', which deals with all sorts of nasty
things that happen when ">" is a template bracket, or might be one.
(Don't blame me for the stupidity/malice of the idiots who thought that
the greater-than sign was so pretty it could be abused as a parenthesis,
leading to syntactically unparseable code.)
Please be careful when rebinding "ordinary" keys. Particularly in CC
Mode, quite a lot of ordinary looking keys are actually "electric" keys.
> I used company-mode as it has far better search and context help for
> completion candidates. To use the semantic functions simply comment out
> the "(company-mode 1") in the my-cedet-hook in the code below.
> My own set up is here:
> http://richardriley.net/projects/emacs/dotprogramming#sec-1.1
Hmm. You have an illicit '(local-set-key "\C-c\C-r" ...' in that file.
C-c C-<letter> belongs to the major mode. You _probably_ meant to use
C-c r. :-)
> But borrowed heavily from Alex Ott's excellent article (I struggle
> with the CEDET docs as they cover an awful lot of things I haven't a
> clue about!).
> Company mode:
> http://nschum.de/src/emacs/company-mode/
--
Alan Mackenzie (Nuremberg, Germany).