I'm coming to emacs from Xcode. An Xcode feature I really like is the ability to type the lines

#pragma mark -
#pragma mark Section Heading Name

to mark the subsequent part of my code as belonging to a particular section. I can then jump to that section from a drop-down menu.

Does a similar ability to break up code into named sections and to jump to a section by name exist in emacs?

link|improve this question

feedback

2 Answers

up vote 0 down vote accepted

This is often called folding. There are several folding packages for Emacs.

  • A commonly used package is the simply-named folding package. It's not shipped with Emacs, you have to install it separately. Its preferred markers are {{{}}} but they can be configured.

  • You can use the built-in Outline minor mode. Set outline-regexp to "#pragma mark" and perhaps write an appropriate outline-level.

  • You may also be interested in hs-minor-mode, hide-ifdef-mode, and FoldDwim.

link|improve this answer
Awesome, thanks for the many different packages. – Jon Rodriguez Oct 6 '10 at 4:54
feedback

emacs has something called bookmarks, maybe it can be useful, take a look here (or here: http://www.cs.cmu.edu/cgi-bin/info2www?(emacs)Bookmarks).

You can also type inside emacs:

Ctrl + h a bookmark Enter

to see a list of functions about that.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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