From: Jeff Barczewski Date: 2007-09-25T04:37:11+09:00 Subject: Re: Emacs, Ruby, and Fode Colding :) ------=_Part_8594_17155221.1190662630696 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 9/22/07, Samantha wrote: > > Looks like the questions about vim code folding were answered - as for > emacs, I was able to find something the other day to do what I needed to > do. I like indentation based code folding as opposed to mark based. > > So, I made my searches a little more specific in regards to indentation > based folding. I found something geared for python that someone put into > their .emacs file and just placed it in mine, but adapted for Ruby. (There > wasn't much adaptation to do) Samantha, I was just going to post about this very technique, so just for completeness and to benefit future readers. Here is a very simple way to get some folding (or outlining) in emacs for ruby Adding this to my .emacs ;;; enables outlining for ruby ;;; You may also want to bind hide-body, hide-subtree, show-substree, ;;; show-all, show-children, ... to some keys easy folding and unfolding (add-hook 'ruby-mode-hook '(lambda () (outline-minor-mode) (setq outline-regexp " *\\(def \\|class\\|module\\)"))) This adds the outline-minor-mode to your ruby buffers. You will also most likely want to bind some hide and show functions to appropriate keys if you don't like the defaults (or they conflict with others). More details are here http://www.emacswiki.org/cgi-bin/wiki/OutlineMode http://www.emacswiki.org/cgi-bin/wiki/EasyCodeOutline hide-body, hide-subtree, show-subtree, show-all, show-children and the other hide* and show* methods are what you will use to collapse or expand, so you may want to bind them to convenient keys if the default bindings don't work for you. Blessings, Jeff -- Jeff Barczewski, MasterView core team Inspired Horizons Ruby on Rails Training and Consultancy http://inspiredhorizons.com/ ------=_Part_8594_17155221.1190662630696--