unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Collapse all include lines?
Date: Sun, 15 May 2022 18:30:35 -0400	[thread overview]
Message-ID: <jwvmtfibfgl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: CAJnXXohFH1Dn_AoBtO6BQBP3pDy=+itNe-V9v6DTcBXgPRWACA@mail.gmail.com

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




  parent reply	other threads:[~2022-05-15 22:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 22:28 Collapse all include lines? John Yates
2022-05-13 22:36 ` Emanuel Berg
2022-05-14  6:21 ` Eli Zaretskii
2022-05-14 20:17   ` John Yates
2022-05-14 21:53     ` Emanuel Berg
2022-05-15  5:13     ` Eli Zaretskii
2022-05-15 14:39       ` Emanuel Berg
2022-05-15 21:05       ` John Yates
2022-05-15 21:29         ` Emanuel Berg
2022-05-15 21:41           ` Emanuel Berg
2022-05-15 21:07       ` John Yates
2022-05-15 22:30 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2022-05-16  0:37   ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmtfibfgl.fsf-monnier+emacs@gnu.org \
    --to=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).