Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Torstein Krause Johansen
Torstein Krause Johansen
@skybert@hachyderm.io  ·  activity timestamp 2 weeks ago

TIL Emacs has code folding built in (of course it has!). Enable it with `hs-minor-mode` and toggle function, class or comment folding/unfolding with `hs-cycle`. There are many other commands to try too: `hs-hide-all`, `hd-show-all` and so on.

#emacs #coding

Emacs showing off code folding
Emacs showing off code folding
Emacs showing off code folding
  • Copy link
  • Flag this post
  • Block
Boško Ivanišević
Boško Ivanišević
@bosko@ruby.social replied  ·  activity timestamp 2 weeks ago

@skybert For quick folding of some level applied to the whole file I find "set-selective-display" (C-x $) which with numerical prefix hides lines with identation larger or equal to that value.

  • Copy link
  • Flag this comment
  • Block
Boško Ivanišević
Boško Ivanišević
@bosko@ruby.social replied  ·  activity timestamp 2 weeks ago

@skybert `hs-cycle` isn't part of `hs-minor-mode`, right?

  • Copy link
  • Flag this comment
  • Block
Torstein Krause Johansen
Torstein Krause Johansen
@skybert@hachyderm.io replied  ·  activity timestamp 2 weeks ago

@bosko no , it *is* a part of it, see: https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/hideshow.el#L1427

GitHub

emacs/lisp/progmodes/hideshow.el at master · emacs-mirror/emacs

Mirror of GNU Emacs. Contribute to emacs-mirror/emacs development by creating an account on GitHub.
  • Copy link
  • Flag this comment
  • Block
Boško Ivanišević
Boško Ivanišević
@bosko@ruby.social replied  ·  activity timestamp 2 weeks ago

@skybert Ah, ok. It was added in December last year and was not ported to emacs-30. That's why I didn't see it 😉

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.2-alpha.23 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct