vlion: magical weaponized pony! (weaponized pony)
vlion ([personal profile] vlion) wrote in [community profile] emacs2011-10-31 10:49 pm
Entry tags:

hs-mode

Hide-Show mode gives you the ability to code fold reasonably intelligently. Hit a key, fold the code. Hit a key, unfold the code. It's particular handy for Lisp use, I've noticed. I've been able to use it for Python as well.

Here's some snippets

(global-set-key "\M-`" 'hs-toggle-hiding)

(add-hook 'c-mode-common-hook 'hs-minor-mode)
(add-hook 'emacs-lisp-mode-hook 'hs-minor-mode)
(add-hook 'java-mode-hook 'hs-minor-mode)
(add-hook 'lisp-mode-hook 'hs-minor-mode)
(add-hook 'perl-mode-hook 'hs-minor-mode)
(add-hook 'sh-mode-hook 'hs-minor-mode)

Or, to start it, M-x hs-mode.


Reference: http://www.emacswiki.org/cgi-bin/wiki/HideShow

[personal profile] tamouse 2011-11-02 08:38 pm (UTC)(link)
Neat!! Folding code isn't something I've done often, but when I need it, it's nice to know it's there!