* Collapse all include lines?
@ 2022-05-13 22:28 John Yates
2022-05-13 22:36 ` Emanuel Berg
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: John Yates @ 2022-05-13 22:28 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
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?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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-15 22:30 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2022-05-13 22:36 UTC (permalink / raw)
To: help-gnu-emacs
John Yates wrote:
> Is that a package that will let me initially collapse, but
> optionally expand, an expanse of #include and blank lines?
No doubt, first stop would be your C (C++?) mode that already
does collapsing, can it do what you look for? If not ...
Elispers already at work :)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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-15 22:30 ` Stefan Monnier via Users list for the GNU Emacs text editor
2 siblings, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2022-05-14 6:21 UTC (permalink / raw)
To: help-gnu-emacs
> From: John Yates <john@yates-sheets.org>
> Date: Fri, 13 May 2022 18:28:49 -0400
>
> 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?
Did you look at hideif.el?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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
0 siblings, 2 replies; 13+ messages in thread
From: John Yates @ 2022-05-14 20:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Help Gnu Emacs mailing list
On Sat, May 14, 2022 at 2:21 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> Did you look at hideif.el?
No I did not. But now that I have, it is largely what
I recall and does not seem to meet my needs.
hideif is focussed on understanding preprocessor
#if constructs and their attendant expressions.
My need is much simpler. I simply want to identify
a run of #include lines with potentially interleaved
blank (and maybe comment?) lines. When I open
a file I would like all those lines hidden. On rather
rare occasions I may need to expose those lines.
But, by and large, I do not want to see them
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
2022-05-14 20:17 ` John Yates
@ 2022-05-14 21:53 ` Emanuel Berg
2022-05-15 5:13 ` Eli Zaretskii
1 sibling, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2022-05-14 21:53 UTC (permalink / raw)
To: help-gnu-emacs
John Yates wrote:
> My need is much simpler. I simply want to identify a run of
> #include lines with potentially interleaved blank (and maybe
> comment?) lines. When I open a file I would like all those
> lines hidden. On rather rare occasions I may need to expose
> those lines. But, by and large, I do not want to see them
Yes 100% understood.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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
` (2 more replies)
1 sibling, 3 replies; 13+ messages in thread
From: Eli Zaretskii @ 2022-05-15 5:13 UTC (permalink / raw)
To: help-gnu-emacs
> From: John Yates <john@yates-sheets.org>
> Date: Sat, 14 May 2022 16:17:16 -0400
> Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
>
> On Sat, May 14, 2022 at 2:21 AM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > Did you look at hideif.el?
>
> No I did not. But now that I have, it is largely what
> I recall and does not seem to meet my needs.
>
> hideif is focussed on understanding preprocessor
> #if constructs and their attendant expressions.
>
> My need is much simpler. I simply want to identify
> a run of #include lines with potentially interleaved
> blank (and maybe comment?) lines. When I open
> a file I would like all those lines hidden. On rather
> rare occasions I may need to expose those lines.
> But, by and large, I do not want to see them
Is it conceivable to wrap those #include lines by something like
#ifndef DON'T_WANT_TO_SEE
...
#endif
? If so, you could then teach hideif.el to hide this block.
Another possibility (100% unexplored) is to define a jit-lock function
which will put the 'invisible' property on such a block (assuming it
can be easily identified).
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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:07 ` John Yates
2 siblings, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2022-05-15 14:39 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii wrote:
> Is it conceivable to wrap those #include lines by something
> like
>
> #ifndef DON'T_WANT_TO_SEE
> ...
> #endif
>
> ?
It's conceivable but not recommended.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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:07 ` John Yates
2 siblings, 1 reply; 13+ messages in thread
From: John Yates @ 2022-05-15 21:05 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Help Gnu Emacs mailing list
On Sun, May 15, 2022 at 1:13 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> Is it conceivable to wrap those #include lines by something like
>
> #ifndef DON'T_WANT_TO_SEE
> ...
> #endif
I have authority to do that only to files owned
by my team. Those are only a tiny fraction of
all the files with which I interact. Furthermore,
even my own team is likely to resist modifying
code merely to cater to my whims :-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
2022-05-15 21:05 ` John Yates
@ 2022-05-15 21:29 ` Emanuel Berg
2022-05-15 21:41 ` Emanuel Berg
0 siblings, 1 reply; 13+ messages in thread
From: Emanuel Berg @ 2022-05-15 21:29 UTC (permalink / raw)
To: help-gnu-emacs
John Yates wrote:
>> Is it conceivable to wrap those #include lines by something
>> like
>>
>> #ifndef DON'T_WANT_TO_SEE
>> ...
>> #endif
>
> I have authority to do that only to files owned by my team.
> Those are only a tiny fraction of all the files with which
> I interact. Furthermore, even my own team is likely to
> resist modifying code merely to cater to my whims :-)
Yeah, plus the very idea to change data to solve an
interface issue.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
2022-05-15 21:29 ` Emanuel Berg
@ 2022-05-15 21:41 ` Emanuel Berg
0 siblings, 0 replies; 13+ messages in thread
From: Emanuel Berg @ 2022-05-15 21:41 UTC (permalink / raw)
To: help-gnu-emacs
>>> Is it conceivable to wrap those #include lines by
>>> something like
>>>
>>> #ifndef DON'T_WANT_TO_SEE
>>> ...
>>> #endif
>>
>> I have authority to do that only to files owned by my team.
>> Those are only a tiny fraction of all the files with which
>> I interact. Furthermore, even my own team is likely to
>> resist modifying code merely to cater to my whims :-)
>
> Yeah, plus the very idea to change data to solve an
> interface issue.
Also that's not needed. We can easily recognize such areas
from Elisp.
After that its hidden and replaced with a button; hitting RET
while on that button will show it again will show it while
keeping the button if on would like to close it again.
Gnus does this, for example, with cite regions.
I don't like to do this myself (for source) so can't help you
with the second part (button to hide/show) but that's how/one
way it would/could be done ...
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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:07 ` John Yates
2 siblings, 0 replies; 13+ messages in thread
From: John Yates @ 2022-05-15 21:07 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Help Gnu Emacs mailing list
On Sun, May 15, 2022 at 1:13 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> Another possibility (100% unexplored) is to define a jit-lock function
> which will put the 'invisible' property on such a block (assuming it
> can be easily identified).
Sounds promising. I will investigate.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Collapse all include lines?
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-15 22:30 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-05-16 0:37 ` Emanuel Berg
2 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-05-15 22:30 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-05-16 0:37 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2022-05-16 0:37 ` Emanuel Berg
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).