Hello, Since Org 9.8, TAB (org-cycle), C-RET (org-insert-heading-respect-content) and other commands built on org-back-to-heading fail when point is at the start of a heading whose stars carry an `invisible' text property, as heading prettifiers set them (for example org-modern with `org-modern-hide-stars' set to t):
Before first headline at position 12 in buffer *temp* Point is on a heading line that is not folded, so the message is wrong. Org 9.7.11 handles the same buffer correctly. Recipe, from emacs -Q: ;; emacs -Q --batch -L /path/to/org-9.8.10 -l repro.el (require 'org) (with-temp-buffer (insert "* One\nText\n* Two\nText\n") (org-mode) ;; Hide the stars of "* Two" the way heading prettifiers do ;; (e.g. org-modern with `org-modern-hide-stars' set to t). (add-to-invisibility-spec 'hide-stars) (goto-char (point-min)) (re-search-forward "^\\* Two") (forward-line 0) (put-text-property (point) (+ (point) 2) 'invisible 'hide-stars) (message "Org %s: (org-at-heading-p t) => %S" (org-version) (org-at-heading-p t)) (condition-case err (progn (org-cycle) (message "org-cycle: ok")) (error (message "org-cycle: %s" (error-message-string err))))) Output with Org 9.8.10: Org 9.8.10: (org-at-heading-p t) => nil org-cycle: Before first headline at position 12 in buffer *temp* Output with Org 9.7.11, as bundled with Emacs 30.2: Org 9.7.11: (org-at-heading-p t) => t org-cycle: ok Cause: in 9.7.11, org-at-heading-p and org-back-to-heading asked org-fold-folded-p whether a heading is hidden. In 9.8.10 both call (org-invisible-p), which is non-nil for any invisible text, including text hidden by fontification. org-at-heading-p with INVISIBLE-NOT-OK then rejects the heading, the org-element-lineage-map fallback in org-back-to-heading rejects it for the same reason, and the user-error follows. I could not find this change in ORG-NEWS, so it may be unintended. org-invisible-p already has an argument for this case: with FOLDING-ONLY it "only consider[s] invisible parts due to folding [...] i.e., not because of fontification". Using it in both functions restores the 9.7 behaviour: (not (org-invisible-p nil t)) ; instead of (not (org-invisible-p)) With that change the recipe above works, and a heading inside a folded subtree still counts as hidden: (org-at-heading-p t) => nil. Emacs: GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.52, cairo version 1.18.4) Org: 9.8.10, from GNU ELPA Marcin
