Subject: bug#63444: folding mode for Texinfo doesn't work reliably

From: Arash Esbati <[email-masked]>
Date: Fri, 12 May 2023 10:22:50 +0200

Werner LEMBERG <[email-masked]> writes:

> Consider this quite complicated Texinfo macro file from LilyPond's
> documentation:
>
>   https://gitlab.com/lilypond/lilypond/-/blob/master/Documentation/ca/macros.itexi
>
> If I call `TeX-fold-buffer`, some macros like `rnotation` are
> properly folded, but many others like `snippets` or `englishref` are
> not.
>
> It seems that the presence of a `@xxx` command within a macro causes
> hiccups, but as `englishref` shows, other factors seem to play a role,
> too.

I'm not sure if I understand this part.  Can you please give me a hint
where to look in that file and what to do in order to understand this
issue better?

> Finally, I have a wish: It would be extremely helpful to have two more
> commands for folding
>
> * conditional blocks like `@iffoo ... @end iffoo`, and
>
> * format-specific blocks like `@html ... @end html` or `@tex ... @end
>   tex`.

You can put this in your init file (and adjust it accordingly):

(setq Texinfo-fold-env-spec-list
      '(("[html]"  ("html"))
        ("[TeX]"   ("tex"))))

and then load your .texi file and activate folding.  Maybe that helps
already.

Best, Arash