help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple collapse sections of code?


From: Mathias Dahl
Subject: Re: multiple collapse sections of code?
Date: Wed, 04 Oct 2006 09:37:24 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

"Mickey Ferguson" <MFerguson@plantcml.com> writes:

> For simplification, I've made the function much smaller, and not
> used real function calls or anything.  But as I'm viewing the code,
> suppose that right now I'm not interested in seeing the error
> handling code.  Within Visual Studio you can click on a little minus
> sign that is to the left of the braces, and it will collapse and
> hide all of the code that is within the braces, replacing it with a
> plus sign.  Clicking on that plus sign expands it so that the error
> handling code is visible again.  You can have many parts collapsed
> at any given time.

You should try out `outline-minor-mode'. I use it in Java files
sometimes to hide blocks of code.

For easy access, I have bound new keys to the hide- and show-subtree
commands:

 (defun my-outline-minor-mode-keys ()
   (define-key outline-minor-mode-map (kbd "<C-kp-subtract>") 'hide-subtree)
   (define-key outline-minor-mode-map (kbd "<C-kp-add>") 'show-subtree))

 (add-hook 'outline-minor-mode-hook 'my-outline-minor-mode-keys)

To use, place point at a opening bracket and type C-kp-substract (that
is the minus key on the numeric keypad).

Try it out and see if it works for you.

/Mathias


reply via email to

[Prev in Thread] Current Thread [Next in Thread]