Merge branch 'bugfix'

This commit is contained in:
Ihor Radchenko 2023-08-16 11:43:12 +03:00
commit e4504853b5
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 27 additions and 14 deletions

View File

@ -6812,19 +6812,7 @@ The function returns the new value of `org-element--cache-change-warning'."
(setq org-element--cache-last-buffer-size (buffer-size))
(goto-char beg)
(forward-line 0)
(let ((bottom (save-excursion
(goto-char end)
(if (and (bolp)
;; When beg == end, still extent to eol.
(> (point) beg))
;; FIXME: Potential pitfall.
;; We are appending to an element end.
;; Unless the last inserted char is not
;; newline, the next element is not broken
;; and does not need to be purged from the
;; cache.
end
(line-end-position)))))
(let ((bottom (save-excursion (goto-char end) (line-end-position))))
(prog1
;; Use the worst change warning to not miss important edits.
;; This function is called before edit and after edit by

View File

@ -5194,7 +5194,32 @@ paragraph
(let ((org-element-use-cache t))
(org-element-at-point (point-max))
(delete-region (point) (point-max))
(should (eq 'paragraph (org-element-type (org-element-at-point)))))))
(should (eq 'paragraph (org-element-type (org-element-at-point))))))
;; Remove/re-introduce heading.
(org-test-with-temp-text
"
* 1
** 1-1
a
<point>** 1-2
a
"
(let ((org-element-use-cache t))
(org-element-at-point (point-max))
(insert "FOO")
(should
(equal
"1-1"
(org-element-property
:title
(org-element-lineage (org-element-at-point) '(headline)))))
(insert "\n")
(should
(equal
"1"
(org-element-property
:title
(org-element-lineage (org-element-at-point) '(headline))))))))
(provide 'test-org-element)