Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is any extension in Emacs can shrink and expand a block of code

18 views
Skip to first unread message

Qiang Yu

unread,
Aug 10, 2012, 10:55:26 AM8/10/12
to help-gn...@gnu.org
Hi all,

Is there any extension in Emacs can shrink and expand a block of code?

For example:

int foo()
{
    return 0;
}

the content in "{}" can be shrunk to like:

int foo()
{...}

and I can expand it back.

Regards,
yuq

drain

unread,
Aug 10, 2012, 12:48:23 PM8/10/12
to Help-gn...@gnu.org
Add this to your .emacs:

;; collapsible code

(global-set-key "\C-x\M-h" 'hs-minor-mode)

(global-set-key "\C-c\C-h" 'hs-toggle-hiding)
(global-set-key "\C-c\M-h" 'hs-hide-all)
(global-set-key "\C-c\M-s" 'hs-show-all)

I suggest adjusting the particular bindings to your taste and style.





--
View this message in context: http://emacs.1067599.n5.nabble.com/Is-any-extension-in-Emacs-can-shrink-and-expand-a-block-of-code-tp261127p261142.html
Sent from the Emacs - Help mailing list archive at Nabble.com.

Andreas Röhler

unread,
Aug 10, 2012, 1:04:18 PM8/10/12
to help-gn...@gnu.org
hs-minor-mode from hideshow.el

see also

cc-mod...@lists.sourceforge.net

0 new messages