org-element--cache-for-removal: Error out of irrecoverable failure

* lisp/org-element.el (org-element--cache-for-removal): Consider wrong
parent to be critical failure: reset the cache and abort current
command.
This commit is contained in:
Ihor Radchenko 2021-11-27 12:07:02 +08:00
parent 49df468849
commit e1aebc1a41
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 1 deletions

View File

@ -6700,7 +6700,9 @@ known element in cache (it may start after END)."
(when robust-flag (setq robust-flag nil))))
(unless (or (org-element-property :parent up)
(eq 'org-data (org-element-type up)))
(org-element--cache-warn "Got element without parent. Please report it to Org mode mailing list (M-x org-submit-bug-report).\n%S" up))
(org-element--cache-warn "Got element without parent. Please report it to Org mode mailing list (M-x org-submit-bug-report).\n%S" up)
(org-element-cache-reset)
(error "org-element--cache: Emergency exit"))
(setq up (org-element-property :parent up)))
;; We're at top level element containing ELEMENT: if it's
;; altered by buffer modifications, it is first element in