Shortcut for inserting environments in `org-mode`

Org has a facility called "Easy templates": http://orgmode.org/manual/Easy-Templates.html

A template for comment is missing but you can add it with:

(add-to-list 'org-structure-template-alist '("C" "#+begin_comment\n?\n#+end_comment"))

And use it by typing <C followed by TAB.

Alternatively, you could use yasnippet.


Now the corresponding template section is called Structure Template and the insertion sequence is invoked by C-c C-,. I didn't (require 'org-tempo) which is described to support insertion keys like <s TAB.

The comment environment is already defined in org-structure-template-alist. So the comment would be inserted by

C-c C-, C

It's still possible to add a user defined sequence by, for example,

C-c C-, [TAB|RET|SPC] src python :results output :session

delivering

#+begin_src python :results output :session
#+end_src

(emacs 25.2.2, org-mode 9.2)