commit/cc-mode: acm: Fix a bug in the state cache mechanism. Refactor this a bit.