[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73724: [PATCH] Add folding support for begin and end macros
From: |
Paul Nelson |
Subject: |
bug#73724: [PATCH] Add folding support for begin and end macros |
Date: |
Wed, 9 Oct 2024 22:37:14 +0200 |
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
Description: Binary data
- bug#73724: [PATCH] Add folding support for begin and end macros,
Paul Nelson <=