0

How to fold arbitrary blocks of text?

Something like #BEGIN_SRC org .. but don't edit in another mode... using <language> 'org' doesn't really work, for example, enter on a [[link]] fails. Drawers don't seem to work except after a heading. BEGIN _EXAMPLE, or _VERSE _QUOTE all have issues. I want something like a heading with an end marker (that isn't another header).

#+BEGIN_SRC org
whatever text... edit etc the same as all other org text
but allow folding this block 
(and enter on '[[link]]' should still work)
#+END_SRC
  • 1
    There are several hits on Google search for folding an org-mode source code block (including ones that I have previously answered) -- have you looked at any of those previous threads to see if those answer your question? My recollection is that org-mode may also have something built-in to support this. – lawlist May 5 '16 at 19:52
0

The quote block will do some of what you want. You can get a quote block through the templating system -- type <q, then hit <TAB>, to make a quote block. Quote blocks are foldable and respect org's markup syntax, so links still work. They do get incredibly strange if you try to insert a header inside one, so maybe give that a miss.

  • 1
    #+BEGIN_QUOTE ... #+END_QUOTE ... <qTAB is a quick way to create one (I learned 2 new things there). Now I see #+BEGIN_CENTER and #+BEGIN_JUSTIFYLEFT and #+BEGIN_JUSTIFYRIGHT work too (though QUOTE seems best). This is what I wanted. – 9mjb May 22 '16 at 20:58
1

You can use vimish-fold package to achieve arbitrary code folding in any mode in Emacs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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