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 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
add comment

2 Answers 2

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
add comment

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
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.