>> My suggestion is to make Emacs call a function each time a character
>> is inserted into buffer and then check if we are currently standing
>> behind such a use pattern. I believe looking-back() is usable here.
>
>> We also need to check that the cursor is *NOT* currently standing
>> inside a comment or string; How do I query such a context?
>
> Quick&Dirty "solution": use font-lock information, i.e. look at the face
> of the current symbol.
>
> Better solution: Since you are using semantic anyway, you could override
> `semantic-ctxt-current-symbol' for C/C++, so that no symbol is returned
> when the point is in a comment or string. Eric can surely say if this
> would be reasonable to do.
>
> I'm not sure all of this will be fast enough for calling it in something
> like 'post-command-hook, though. Maybe this should just be an extra
> command, which inserts the correct header for the current symbol, if
> necessary?
>
> -David
This looks like something that abbrev-mode, expand and other template
packages do already. I am not sure what you are trying to do and how it
is differs from any of those.
Chetan