forked from mirrors/org-mode
org-lint-invalid-id-link: Improve performance
* lisp/org-lint.el (org-lint-invalid-id-link): Do not try to search for exact position of every ID. Instead, sync all the ID locations once and then make use of the up-to-date locations state to query if an ID is present.
This commit is contained in:
parent
4cf0b0433d
commit
2cf245810b
|
@ -584,11 +584,16 @@ Use :header-args: instead"
|
|||
path)))))))))
|
||||
|
||||
(defun org-lint-invalid-id-link (ast)
|
||||
(org-id-update-id-locations nil t)
|
||||
(org-element-map ast 'link
|
||||
(lambda (link)
|
||||
(let ((id (org-element-property :path link)))
|
||||
(and (equal (org-element-property :type link) "id")
|
||||
(not (org-id-find id))
|
||||
;; The locations are up-to-date with file changes after
|
||||
;; the call to `org-id-update-id-locations'. We do not
|
||||
;; need to double-check if recorded ID is still present
|
||||
;; in the file.
|
||||
(not (org-id-find-id-file id))
|
||||
(list (org-element-begin link)
|
||||
(format "Unknown ID \"%s\"" id)))))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue