Fix Emacs 27 test failure

* lisp/org-id.el (org-id-find-id-in-file): Work around change
functions not always firing up in Emacs 27 when using
`insert-file-contents'.
This commit is contained in:
Ihor Radchenko 2023-08-18 11:10:12 +03:00
parent 933d282881
commit 3ec0933122
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 6 additions and 2 deletions

View File

@ -686,8 +686,12 @@ optional argument MARKERP, return the position as a new marker."
(unless (derived-mode-p 'org-mode) (org-mode))
(unless (or visiting markerp)
(buffer-disable-undo)
(erase-buffer)
(insert-file-contents file))
;; FIXME: In Emacs 27, `insert-file-contents' seemingly
;; does not trigger modification hooks in some
;; scenarios. This is manifested in test failures due
;; to element cache losing track of the modifications.
(org-element-cache-reset)
(insert-file-contents file nil nil nil 'replace))
(let ((pos (org-find-entry-with-id id)))
(cond
((null pos) nil)