I initially thought this was a bug in Emacs. I was very surprised that no one had come across this before.
The following is a workaround:
(dolist (abcc '("Ca" "Cb")) (global-unset-key (read-kbd-macro abcc)))
What happens is kbd, which is a macro that wraps a function, however it does not explicitly evaluate its parameter. Thus, the abcc character is passed directly to the function.
After a bit more thinking (and reading documents). This is actually a user error.
The doc string for kbd clearly states that it should be used for string constants.
So, kbd should be used when it is only required that the internal representation of the key is displayed in the compiled bytecode. eg.
(define-key foo-mode-map (kbd "Ca") 'foo)
But read-kbd-macro should be used when you want the argument to be evaluated.
source share