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: Colin S. Miller
Subject: Re: multiple collapse sections of code?
Date: Wed, 04 Oct 2006 18:18:26 +0100
User-agent: Thunderbird 1.5.0.5 (X11/20060812)

Mickey Ferguson wrote:
Suppose I'm writing some C++ code that looks like the following:

  if (MyFunc() != NO_ERROR)

  {

    // now we start a big, complicated error handling routine

    CallFirstErrorHandlingRoutine();

    CallSecondEHRoutine();

    CallYetMore();

    // there would be much more, but I've abbreviated for simplicity

  }

Mickey,

hs-minor-mode also does this.

I find these bindings more comfortable than the defaults

(add-hook 'hs-minor-mode-hook '(lambda ()
(define-key hs-minor-mode-map [(control c) (control \') (control h)] 
'hs-hide-block)
(define-key hs-minor-mode-map [(control c) (control \') (control s)] 
'hs-show-block)
(define-key hs-minor-mode-map [(control c) (control \') (control meta h)] 
'hs-hide-all)
(define-key hs-minor-mode-map [(control c) (control \') (control meta s)] 
'hs-show-all)
(define-key hs-minor-mode-map [(control c) (control \') (control l)] 
'hs-hide-level)
(define-key hs-minor-mode-map [(control c) (control \') (control c)] 
'hs-toggle-hiding)
))


It will place ellipsises after each folded block.

You can expand the block by right clicking on the ellipsis,
although I agree that a [+] icon would be more intuitive.

HTH,
Colin S. Miller


reply via email to

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