exam documentclass automated \choice on emacs auctex

I am using the exam class to write some multiple choice questions on emacs. How can I achieve some sort of automatic \choice key combination in the checkboxes environment etc. Just like that I can use M-RET to achieve automatic \item in the itemize or enumerate environment?

In fact, some days ago I accidentally found out that I can use M-j to get what I want, but I lost it soon afterwards, and sadly I cannot regenerated the situation ever again. Do I need to activate something? Thanks in advance!

You have to hack LaTeX-item-list. Honestly, this is a bit uncomfortable to do because it should be a task for style files.

(add-hook 'LaTeX-mode-hook
(lambda ()
'LaTeX-item-list
'("checkboxes" . (lambda ()
(let (TeX-insert-braces)
(TeX-insert-macro "choice ")))))

In this way, you can type C-c C-j in choices and checkboxes environments and a newline will be inserted, with new line starting with \choice.
I did it only for a couple of environments, if you want to include others follow the example for checkboxes.
• this is great! by any chance do you know some possibility how got it by accident before? i did not add anything related to choice or checkboxes before. as you mentioned, is there a style file for exam? thanks~ – davyjones Apr 7 '16 at 13:04
• C-c C-j will always insert \item as if point were in an itemize environment, unless it is in another environment listed in LaTeX-item-list. Unfortunately not, AUCTeX doesn't provide an exam style file, I could try writing down one some day. – giordano Apr 7 '16 at 14:48