forked from mirrors/org-mode
org-lint-invalid-id-link: Only update ID locations if there are ID links
* lisp/org-lint.el (org-lint-invalid-id-link): Avoid running `org-id-update-id-locations' when there are no ID links in the linted file.
This commit is contained in:
parent
83fd03fb6d
commit
d560a2d739
|
@ -585,18 +585,23 @@ Use :header-args: instead"
|
||||||
path)))))))))
|
path)))))))))
|
||||||
|
|
||||||
(defun org-lint-invalid-id-link (ast)
|
(defun org-lint-invalid-id-link (ast)
|
||||||
(org-id-update-id-locations nil t)
|
(let ((id-locations-updated nil))
|
||||||
(org-element-map ast 'link
|
(org-element-map ast 'link
|
||||||
(lambda (link)
|
(lambda (link)
|
||||||
(let ((id (org-element-property :path link)))
|
(let ((id (org-element-property :path link)))
|
||||||
(and (equal (org-element-property :type link) "id")
|
(and (equal (org-element-property :type link) "id")
|
||||||
;; The locations are up-to-date with file changes after
|
(progn
|
||||||
;; the call to `org-id-update-id-locations'. We do not
|
(unless id-locations-updated
|
||||||
;; need to double-check if recorded ID is still present
|
(org-id-update-id-locations nil t)
|
||||||
;; in the file.
|
(setq id-locations-updated t))
|
||||||
(not (org-id-find-id-file id))
|
t)
|
||||||
(list (org-element-begin link)
|
;; The locations are up-to-date with file changes after
|
||||||
(format "Unknown ID \"%s\"" id)))))))
|
;; 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))))))))
|
||||||
|
|
||||||
(defun org-lint-confusing-brackets (ast)
|
(defun org-lint-confusing-brackets (ast)
|
||||||
(org-element-map ast 'link
|
(org-element-map ast 'link
|
||||||
|
|
Loading…
Reference in a new issue