# Add key binding to emacs in AucTeX does not fully work

Based on the discussion in these questions (1, 2, 3), I created the following key bindings for AucTeX in emacs.

(defun AucTeX-LaTeX-beginendgroup ()
(local-set-key (kbd "C-{") "\\begingroup
")
(local-set-key (kbd "C-}") "\\endgroup
"))



I wanted to create key binding in AucTeX to input text \begingroup RET when Ctrl-{ is pressed, and input \endgroup RET when Ctrl-} is pressed.

Emacs loads the style mode hooks successfully without any complaints.

While the first one (Ctrl-{), works fine (also C-h k C-{ reports correctly), the second one (Ctrl-}) does not work. Moreover, C-h k C-} remains silent without an answer.

I am really clueless about what could have gone wrong.

• Shouldn't the last argument be a function? In this case one defined to (insert the given string. – Andrew Swann Nov 14 '14 at 8:18
• @AndrewSwann Then why does the first binding work? – Masroor Nov 14 '14 at 8:31
• As commented by Malabarba on the question on mx.sx, sending a string this way outputs the string as a keyboard macro. This means inserting the string, if it doesn't contain a character whose key is bound to something different from self-insert-command. emacs.stackexchange.com/a/3530/184 – T. Verron Nov 14 '14 at 12:26

(eval-after-load "latex"

• Your proposed solution produces the same result as mine. The first one works, the second one does not. Even in an uninitialized state emacs remains silent when Ctrl-} is pressed. Any idea why this happens? I am using Ubuntu by the way. – Masroor Nov 14 '14 at 10:38
• I completely emptied my init file. Even then Ctrl-} is unresponsive. – Masroor Nov 14 '14 at 10:58
• @Masroor in ubuntu start off in keyboard settings, I could recreate your problem by assigning say Ctrl-} to universal access, for example, and it would remain silent, once in emacs – doed Nov 17 '14 at 3:21