Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.

share|improve this answer
    
Awesome, thanks for the many different packages. – AlcubierreDrive Oct 6 '10 at 4:54

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .