0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-08-26 01:32:53 +00:00

org-fold-core-get-folding-spec: Fix edge case

* lisp/org-fold-core.el (org-fold-core-get-folding-spec): When SPEC is
nil, do not rely upon 'invisible property value to determine the fold.
Examine unique property set by `org-fold-region' instead.
This commit is contained in:
Ihor Radchenko 2024-02-26 15:51:31 +03:00
parent 655e97208c
commit 8bac4d386a
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B

View file

@ -784,19 +784,16 @@ corresponding folding spec (if the text is folded using that spec)."
(when (and spec (not (eq spec 'all))) (org-fold-core--check-spec spec)) (when (and spec (not (eq spec 'all))) (org-fold-core--check-spec spec))
(org-with-point-at pom (org-with-point-at pom
(cond (cond
((eq spec 'all) ((or (null spec) (eq spec 'all))
(let ((result)) (catch :single-spec
(dolist (spec (org-fold-core-folding-spec-list)) (let ((result))
(let ((val (if (eq org-fold-core-style 'text-properties) (dolist (lspec (org-fold-core-folding-spec-list))
(get-text-property (point) (org-fold-core--property-symbol-get-create spec nil t)) (let ((val (if (eq org-fold-core-style 'text-properties)
(get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t))))) (get-text-property (point) (org-fold-core--property-symbol-get-create lspec nil t))
(when val (push val result)))) (get-char-property (point) (org-fold-core--property-symbol-get-create lspec nil t)))))
(reverse result))) (when (and val (null spec)) (throw :single-spec val))
((null spec) (when val (push val result))))
(let ((result (if (eq org-fold-core-style 'text-properties) (reverse result))))
(get-text-property (point) 'invisible)
(get-char-property (point) 'invisible))))
(when (org-fold-core-folding-spec-p result) result)))
(t (if (eq org-fold-core-style 'text-properties) (t (if (eq org-fold-core-style 'text-properties)
(get-text-property (point) (org-fold-core--property-symbol-get-create spec nil t)) (get-text-property (point) (org-fold-core--property-symbol-get-create spec nil t))
(get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t)))))))) (get-char-property (point) (org-fold-core--property-symbol-get-create spec nil t))))))))