branch: externals/auctex commit 5f40b686b46f74c441441839ad67703b743c900f Author: Paul Nelson <ultr...@gmail.com> Commit: Arash Esbati <ar...@gnu.org>
Call custom folding functions with consistent point * tex-fold.el (TeX-fold-hide-item): Call folding spec with point at beginning of item. * doc/auctex.texi (Folding): Mention the new convention. (bug#70331) --- doc/auctex.texi | 9 +++++---- tex-fold.el | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/doc/auctex.texi b/doc/auctex.texi index 343caa5903..064ba297ac 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -2767,10 +2767,11 @@ respective mandatory argument of a @LaTeX{} macro will be used as the placeholder. If the first element is a function symbol, the function will be called -with all mandatory arguments of the macro and the result of the function -call will be used as a replacement for the macro. -Such functions typically return a string, but may also return the -symbol @code{abort} to indicate that the macro should not be folded. +with all mandatory arguments of the macro, and with point positioned at +the beginning of the macro. The result of the function call will be used +as a replacement for the macro. Such functions typically return a string, +but may also return the symbol @code{abort} to indicate that the macro +should not be folded. The placeholder is made by copying the text from the buffer together with its properties, i.e.@: its face as well. If fontification has not diff --git a/tex-fold.el b/tex-fold.el index e593aed58e..fadc145a13 100644 --- a/tex-fold.el +++ b/tex-fold.el @@ -816,7 +816,9 @@ That means, put respective properties onto overlay OV." (setq arg-list (append arg-list (list (car arg))))) (setq n (1+ n))) (or (condition-case nil - (apply spec arg-list) + (save-excursion + (goto-char ov-start) + (apply spec arg-list)) (error nil)) "[Error: No content or function found]"))) (t (or (TeX-fold-macro-nth-arg spec ov-start ov-end)