emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auctex d74338a1db 12/23: Add new custom option `TeX-fol


From: Tassilo Horn
Subject: [elpa] externals/auctex d74338a1db 12/23: Add new custom option `TeX-fold-region-functions'
Date: Thu, 18 Apr 2024 05:43:24 -0400 (EDT)

branch: externals/auctex
commit d74338a1dbdb7031666b2c193ef5d829b6f5a0ba
Author: Paul Nelson <ultrono@gmail.com>
Commit: Arash Esbati <arash@gnu.org>

    Add new custom option `TeX-fold-region-functions'
    
    * tex-fold.el (TeX-fold-region-functions): New custom option.
    (TeX-fold-region): Use it.
    * doc/auctex.texi (Folding): Document it.  (bug#70330)
---
 doc/auctex.texi | 6 ++++++
 tex-fold.el     | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/doc/auctex.texi b/doc/auctex.texi
index 6e9d33c3a0..343caa5903 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -2649,6 +2649,12 @@ When this variable is non-@code{nil} and there is an 
active regione, text
 around the mark will be kept unfolded.
 @end defopt
 
+@defopt TeX-fold-region-functions
+This variable is a list of functions which allow the user, or external
+packages, to fold additional @LaTeX{} constructs beyond those supported by
+default.
+@end defopt
+
 @deffn Command TeX-fold-region
 @kindex C-c C-o C-r
 (@kbd{C-c C-o C-r}) Hide all configured macros in the marked region.
diff --git a/tex-fold.el b/tex-fold.el
index d786ff629d..e593aed58e 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -324,6 +324,12 @@ and `TeX-fold-math-spec-list', and environments in 
`TeX-fold-env-spec-list'."
       (TeX-fold-clearout-region start end)
       (TeX-fold-region start end))))
 
+(defcustom TeX-fold-region-functions nil
+  "List of additional functions to call when folding a region.
+Each function is called with two arguments, the start and end positions
+of the region to fold."
+  :type '(repeat function))
+
 (defun TeX-fold-region (start end)
   "Fold all items in region from START to END."
   (interactive "r")
@@ -335,7 +341,8 @@ and `TeX-fold-math-spec-list', and environments in 
`TeX-fold-env-spec-list'."
   (when (memq 'math TeX-fold-type-list)
     (TeX-fold-region-macro-or-env start end 'math))
   (when (memq 'comment TeX-fold-type-list)
-    (TeX-fold-region-comment start end)))
+    (TeX-fold-region-comment start end))
+  (run-hook-with-args 'TeX-fold-region-functions start end))
 
 (defun TeX-fold-region-macro-or-env (start end type)
   "Fold all items of type TYPE in region from START to END.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]