branch: main
commit d0a57d8d7e5f5e165e7d480506ca880549659b88
Author: Paul Nelson <[email protected]>
Commit: Arash Esbati <[email protected]>
Fix math macro folding to not consume subsequent brackets
* tex-fold.el (TeX-fold-item-end): Add special handling for math
macros to only fold the macro name itself, not following
arguments. For instance, in "$x \in [0,1]$", this prevents
folding [0,1] as an optional argument to \in. (bug#78627)
---
tex-fold.el | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tex-fold.el b/tex-fold.el
index 766270ef..78e5b822 100644
--- a/tex-fold.el
+++ b/tex-fold.el
@@ -901,6 +901,12 @@ TYPE can be either `env' for environments, `macro' for
macros or
(goto-char (1+ start))
(LaTeX-find-matching-end)
(point))
+ ((eq type 'math)
+ (goto-char (1+ start))
+ (if (zerop (skip-chars-forward "A-Za-z@"))
+ (forward-char)
+ (skip-chars-forward "*"))
+ (point))
(t
(goto-char start)
(TeX-find-macro-end)))))