Fix some emacs mode indentation issues

This fixes some, but not all, of the issues mentioned in #8787