[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 219bc6c2d3 37/44: org-fold-core-fontify-region: Fix
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 219bc6c2d3 37/44: org-fold-core-fontify-region: Fix cases when fontification is not registered |
Date: |
Mon, 25 Apr 2022 07:58:02 -0400 (EDT) |
branch: externals/org
commit 219bc6c2d3d3f794b9e5d8393f51653ba1602396
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-fold-core-fontify-region: Fix cases when fontification is not registered
* lisp/org-fold-core.el (org-fold-core-fontify-region): Handle FORCE
argument better. Skip unnecessary code parts when FORCE is non-nil.
Assign `fontified' text property manually in the actually fontified
regions. We cannot just supply correct return value since jit-lock
does not allow piecewise fontification.
---
lisp/org-fold-core.el | 51 +++++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/lisp/org-fold-core.el b/lisp/org-fold-core.el
index edae316ff4..d98eb63585 100644
--- a/lisp/org-fold-core.el
+++ b/lisp/org-fold-core.el
@@ -1436,40 +1436,43 @@ folded regions.")
(defun org-fold-core-fontify-region (beg end loudly &optional force)
"Run `font-lock-default-fontify-region' in visible regions."
(with-silent-modifications
- (let ((pos beg) next
- (force (or force org-fold-core--force-fontification))
- (org-fold-core--fontifying t)
- (skip-specs
- (let (result)
- (dolist (spec (org-fold-core-folding-spec-list))
- (when (and (not (org-fold-core-get-folding-spec-property spec
:visible))
- (org-fold-core-get-folding-spec-property spec
:font-lock-skip))
- (push spec result)))
- result)))
+ (let* ((pos beg) next
+ (force (or force org-fold-core--force-fontification))
+ (org-fold-core--fontifying t)
+ (skip-specs
+ (unless force
+ (let (result)
+ (dolist (spec (org-fold-core-folding-spec-list))
+ (when (and (not (org-fold-core-get-folding-spec-property
spec :visible))
+ (org-fold-core-get-folding-spec-property spec
:font-lock-skip))
+ (push spec result)))
+ result))))
;; Move POS to first visible point within BEG..END.
- (while (and (catch :found
- (dolist (spec (org-fold-core-get-folding-spec 'all pos))
- (when (org-fold-core-get-folding-spec-property spec
:font-lock-skip)
- (throw :found spec))))
- (< pos end))
- (setq pos (org-fold-core-next-folding-state-change nil pos end)))
+ (unless force
+ (while (and (catch :found
+ (dolist (spec (org-fold-core-get-folding-spec 'all pos))
+ (when (org-fold-core-get-folding-spec-property spec
:font-lock-skip)
+ (throw :found spec))))
+ (< pos end))
+ (setq pos (org-fold-core-next-folding-state-change nil pos end))))
(when force (setq pos beg next end))
(while (< pos end)
(unless force
- (setq next (org-fold-core-next-folding-state-change skip-specs pos
end)))
- ;; Move to the end of the region to be fontified.
- (while (and (not (catch :found
- (dolist (spec (org-fold-core-get-folding-spec 'all
next))
- (when (org-fold-core-get-folding-spec-property spec
:font-lock-skip)
- (throw :found spec)))))
- (< next end))
- (setq next (org-fold-core-next-folding-state-change nil next end)))
+ (setq next (org-fold-core-next-folding-state-change skip-specs pos
end))
+ ;; Move to the end of the region to be fontified.
+ (while (and (not (catch :found
+ (dolist (spec (org-fold-core-get-folding-spec 'all
next))
+ (when (org-fold-core-get-folding-spec-property
spec :font-lock-skip)
+ (throw :found spec)))))
+ (< next end))
+ (setq next (org-fold-core-next-folding-state-change nil next
end))))
(save-excursion
(font-lock-default-fontify-region pos next loudly)
(save-match-data
(unless (<= pos (point) next)
(run-hook-with-args 'org-fold-core-first-unfold-functions pos
next))))
(put-text-property pos next 'org-fold-core-fontified t)
+ (put-text-property pos next 'fontified t)
(setq pos next)))))
(defun org-fold-core-update-optimisation (beg end)
- [elpa] externals/org 77aa9be5ac 11/44: Implement overlay- and text-property-based versions of some functions, (continued)
- [elpa] externals/org 77aa9be5ac 11/44: Implement overlay- and text-property-based versions of some functions, ELPA Syncer, 2022/04/25
- [elpa] externals/org f63ff07441 13/44: Fix subtle differences between overlays and invisible text properties, ELPA Syncer, 2022/04/25
- [elpa] externals/org bf6bd6d21d 14/44: Support extra org-fold optimisations for huge buffers, ELPA Syncer, 2022/04/25
- [elpa] externals/org 4fbd8bfae0 15/44: Alias new org-fold functions to their old shorter names, ELPA Syncer, 2022/04/25
- [elpa] externals/org 8f6ce702bd 22/44: ORG-NEWS: Add list of changes, ELPA Syncer, 2022/04/25
- [elpa] externals/org 444d1c50ac 32/44: test-org/string-width: Add tests for strings with prefix properties, ELPA Syncer, 2022/04/25
- [elpa] externals/org 87babca898 33/44: org--string-from-props: Fix handling folds in Emacs <28, ELPA Syncer, 2022/04/25
- [elpa] externals/org ce58542c85 38/44: org-agenda.el: Re-enable native compilation, ELPA Syncer, 2022/04/25
- [elpa] externals/org 2249f4d7e5 42/44: org-fold-core-fontify-region: Remove unused variable, ELPA Syncer, 2022/04/25
- [elpa] externals/org 407104459b 44/44: org-fold: Honour `org-fold-show-context-detail' for isearch, ELPA Syncer, 2022/04/25
- [elpa] externals/org 219bc6c2d3 37/44: org-fold-core-fontify-region: Fix cases when fontification is not registered,
ELPA Syncer <=
- [elpa] externals/org a6eab82fd6 16/44: Obsolete old function names that are now in org-fold, ELPA Syncer, 2022/04/25
- [elpa] externals/org f813f10818 26/44: Rename remaining org-force-cycle-archived → org-cycle-force-archived, ELPA Syncer, 2022/04/25
- [elpa] externals/org 2e3566e1e9 28/44: org-string-width: Handle undefined behaviour in older Emacs, ELPA Syncer, 2022/04/25
- [elpa] externals/org 240a14988f 24/44: Fix typo: delete-duplicates → delete-dups, ELPA Syncer, 2022/04/25
- [elpa] externals/org 52a0ef94c9 23/44: Backport contributed commits, ELPA Syncer, 2022/04/25
- [elpa] externals/org baffebbc33 25/44: Fix bug in org-get-heading, ELPA Syncer, 2022/04/25
- [elpa] externals/org e8d8db63a0 19/44: Restore old visibility behaviour of org-refile, ELPA Syncer, 2022/04/25
- [elpa] externals/org 3da1b2d240 31/44: org-fold-core: Fix fontification inside folded regions, ELPA Syncer, 2022/04/25
- [elpa] externals/org d048c153dd 08/44: org-string-width: Reimplement to work with new folding, ELPA Syncer, 2022/04/25
- [elpa] externals/org fa7530c7b4 09/44: Rename old function call to use org-fold, ELPA Syncer, 2022/04/25