org-cycle-set-visibility-according-to-property: Do not change ancestor visibility

* lisp/org-cycle.el (org-cycle-set-visibility-according-to-property):
Do not unconditionally run `org-fold-reveal' for headlines with
"VISIBILITY" property.  `org-fold-reveal' can break the global
visibility and ancestor headline visibility settings.
*
testing/lisp/test-org-fold.el (test-org-fold/set-visibility-according-to-property):
Add test.

Reported-by: Eduardo Suarez <esuarez@itccanarias.org>
Link: https://orgmode.org/list/20220409202736.GA28127@itccanarias.org
This commit is contained in:
Ihor Radchenko 2022-10-12 13:47:41 +08:00
parent 88c85d620b
commit eb15341b3c
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 30 additions and 1 deletions

View File

@ -630,7 +630,6 @@ With a numeric prefix, show all headlines up to that level."
(save-excursion
(org-back-to-heading t)
(org-fold-subtree t)
(org-fold-reveal)
(pcase state
("folded"
(org-fold-subtree t))

View File

@ -285,6 +285,36 @@
** <point>b"
(org-set-visibility-according-to-property)
(invisible-p (point))))
(org-test-with-temp-text
"<point>
#+STARTUP: overview
* A
** AA
** AB
*** ABA
:PROPERTIES:
:VISIBILITY: folded
:END:
**** ABAA
**** ABAB
**** ABAC
** AC
* B
"
(org-set-regexps-and-options)
(org-cycle-set-startup-visibility)
(search-forward "A")
(should-not (invisible-p (point)))
(search-forward "AB")
(should (invisible-p (point)))
(search-forward "ABA")
(should (invisible-p (point)))
(search-forward "ABAB")
(should (invisible-p (point)))
(search-forward "AC")
(should (invisible-p (point)))
(search-forward "B")
(should-not (invisible-p (point))))
;; "children" state.
(should
(org-test-with-temp-text