Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using org-mode for organizing myself (very useful so far!). However, it is kind of annoying writting

  #+begin_comment
  ...
  #+end_comment

each time I'd like to insert an environment.

Question

Is there a shortcut to insert the #+begin_ and #+end_ for a given environment?

In the same way C-c C-o comment RET would insert

\begin{comment}

\end{comment}

in latex-mode.

share|improve this question
    
Do you have the package yasnippet installed? –  lawlist Oct 2 '13 at 20:33
    
This question is a duplicate of stackoverflow.com/q/19145433/1225607 –  Francesco Oct 2 '13 at 21:28
add comment

1 Answer 1

up vote 3 down vote accepted

org-mode provides a templating system to easily insert structural elements. Although far less featureful than yasnippet, it can come in handy.

The default templates don't include comment blocks, but you can easily add them by putting something like this in your init file:

(eval-after-load "org"
  '(add-to-list 'org-structure-template-alist
                '("C" "#+BEGIN_COMMENT\n?\n#+END_COMMENT" "")))

After this, you can easily insert comment blocks typing

<C

on a line by itself, then <TAB> to trigger the template expansion.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.