GNU bug report logs -
#73724
[PATCH] Add folding support for begin and end macros
Previous Next
Reported by: Paul Nelson <ultrono <at> gmail.com>
Date: Wed, 9 Oct 2024 20:38:01 UTC
Severity: normal
Tags: patch
Done: Arash Esbati <arash <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This patch supports the folding of \begin{...} and \end{...} macros.
The naive way to attempt such folding in AUCTeX via string
specifications in TeX-fold-macro-spec-list has many drawbacks. I
would be happy to elaborate upon these, but do not do so in this
message.
This patch adds function specifications to TeX-fold-macro-spec-list
and a new user-facing option TeX-fold-begin-end-spec-list that
controls how to fold begin/end arguments. To get a flavor, see the
screenshots at https://github.com/ultronozm/czm-tex-fold.el (but let
me note that I've streamlined the code while preparing this patch).
I'll illustrate here with some examples:
- If the option TeX-fold-begin-end-spec-list is nil, then behavior is as before.
- If the option contains an item such as
(("↴" . "↲") ("itemize" "enumerate" "description" "frame"))
then, e.g., \begin{enumerate} and \end{enumerate} fold to ↴ and ↲,
respectively.
- If the option contains an item such as
((TeX-fold-format-theorem-environment . "◼")
("note" ("theorem" "thm")))
then
- \begin{note} folds to "Note",
- \begin{theorem} and \begin{thm} fold to "Theorem",
- \begin{theorem}[Foo] and \begin{thm}[Foo] fold to "Theorem (Foo)".
- \end{note}, etc., fold to "◼".
I've supplied what I believe to be reasonable defaults (attempting to
err on the conservative side), but would welcome any feedback.
Thanks, best,
Paul
[0001-Add-folding-support-for-begin-and-end-macros.patch (application/octet-stream, attachment)]
This bug report was last modified 214 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.