I had a related situation on my Windows 10 computer using Emacs 26.1, and a Norwegian keyboard layout. I'm used to using CTRL+Alt and one of the number keys to access brackets, but it didn't work in Emacs (it ended up mass-adding characters instead).
amitp's answer got me started, and I ended up adding this to the .emacs
file:
(define-key key-translation-map [(control meta ?7)] [?\{])
(define-key key-translation-map [(control meta ?8)] [?\[])
(define-key key-translation-map [(control meta ?9)] [?\]])
(define-key key-translation-map [(control meta ?0)] [?\}])
On my keyboard, brackets are located on 7-0 using CTRL+Alt or Alt Gr. Alt Gr for brackets works out of the box, but it's (in my opinion) harder to type than using CTRL+Alt. For other keyboard layouts (i.e. German), it's enough just replacing the number with the appropriate number corresponding to the key used for brackets. It's also possible to remove either control
or meta
to just use one of the keys.
This should work on Mac and Linux as well, though I can't confirm if it works on a Mac because I don't have one.