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

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

Re: Collapse all include lines?


From: Stefan Monnier
Subject: Re: Collapse all include lines?
Date: Sun, 15 May 2022 18:30:35 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

John Yates [2022-05-13 18:28:49] wrote:
> At work we have opted to apply Google's IWYU
> (Include What You Use).  This leads much longer
> lists of includes.
>
> Is that a package that will let me initially collapse,
> but optionally expand, an expanse of #include and
> blank lines?

Other than cooking your own solution (which is probably fairly easy
since it's just a short blurb at the beginning of the files and doesn't
change much, so you could do it in an `find-file-hook` or
`c-mode-hook`), I can think of 2 solutions:

1- Use `elide-head`.  It's designed to hide the copyright blurb, but
   I think the regexp should be easy to adjust to match those includes
   as well.

2- Arrange for your files to have additional structure such that you can
   rely on `folding-mode`, `outline-minor-mode`, `hs-minor-mode`, ...
   This is usually much more useful (because you'd apply it not just to
   those include thingies), but it's probably more work to get those
   files changed.
   But if the files already obey such structuring conventions, then it's
   clearly a good option: you just need to teach your favorite minor
   mode how to recognize the structuring elements.


        Stefan




reply via email to

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