I'm trying to add a C++ mode hook to add C++11 keywords to the appropriate keyword lists (which are defined in lisp/progmodes/cc-langs.el in the Emacs source code). As a minimal example, I started with c-modifier-kwds
and tried adding the following to my .emacs file:
(add-hook 'c++-mode-hook
(lambda ()
(c-lang-defconst c-modifier-kwds
c++
(append '("thread_local" "noexcept")
(c-lang-const c-modifier-kwds))))
t)
(I copied the c-lang-defconst
statement from this C++11 mode implementation. However, I don't want to create a whole new mode, I just want to add to the regular C++ mode.)
That didn't work (I didn't really expect it to, either). I also tried the following:
(add-hook 'c++-mode-hook
(lambda ()
(setq (c-lang-defconst c-modifier-kwds)
(append '("thread_local" "noexcept")
(c-lang-const c-modifier-kwds))))
t)
That didn't work either.
What's the right way to do this?
If there is no right way, what's a good hackish way to do this?