org-activate-folds: Skip over folded newlines faster

* lisp/org.el (org-activate-folds): When searching next unfolded
newline skip over folded newlines faster, using org-fold-core API.
This commit is contained in:
Ihor Radchenko 2024-03-12 15:40:37 +03:00
parent b6f8078ab4
commit c9b655f273
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 1 additions and 0 deletions

View File

@ -5812,6 +5812,7 @@ highlighting was done, nil otherwise."
"Arrange trailing newlines after folds to inherit face before the fold."
(let ((next-unfolded-newline (search-forward "\n" limit 'move)))
(while (and next-unfolded-newline (org-fold-folded-p) (not (eobp)))
(goto-char (org-fold-core-next-visibility-change nil limit))
(setq next-unfolded-newline (search-forward "\n" limit 'move)))
(when next-unfolded-newline
(org-with-wide-buffer