mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
(feat): doctor: add check for misspelled roam properties (#703)
This commit is contained in:
@ -69,6 +69,9 @@
|
|||||||
:actions '(("d" . ("Unlink" . org-roam-doctor--remove-link))
|
:actions '(("d" . ("Unlink" . org-roam-doctor--remove-link))
|
||||||
("r" . ("Replace link" . org-roam-doctor--replace-link))
|
("r" . ("Replace link" . org-roam-doctor--replace-link))
|
||||||
("R" . ("Replace link (keep label)" . org-roam-doctor--replace-link-keep-label))))
|
("R" . ("Replace link (keep label)" . org-roam-doctor--replace-link-keep-label))))
|
||||||
|
(make-org-roam-doctor-checker
|
||||||
|
:name 'org-roam-doctor-check-roam-props
|
||||||
|
:description "Check #+ROAM_* properties.")
|
||||||
(make-org-roam-doctor-checker
|
(make-org-roam-doctor-checker
|
||||||
:name 'org-roam-doctor-check-tags
|
:name 'org-roam-doctor-check-tags
|
||||||
:description "Check #+ROAM_TAGS.")
|
:description "Check #+ROAM_TAGS.")
|
||||||
@ -76,6 +79,28 @@
|
|||||||
:name 'org-roam-doctor-check-alias
|
:name 'org-roam-doctor-check-alias
|
||||||
:description "Check #+ROAM_ALIAS.")))
|
:description "Check #+ROAM_ALIAS.")))
|
||||||
|
|
||||||
|
(defconst org-roam-doctor--supported-roam-properties
|
||||||
|
'("ROAM_TAGS" "ROAM_ALIAS")
|
||||||
|
"List of supported Org-roam properties.")
|
||||||
|
|
||||||
|
(defun org-roam-doctor-check-roam-props (ast)
|
||||||
|
"Checker for detecting invalid #+ROAM_* properties.
|
||||||
|
AST is the org-element parse tree."
|
||||||
|
(let (reports)
|
||||||
|
(org-element-map ast 'keyword
|
||||||
|
(lambda (kw)
|
||||||
|
(let ((key (org-element-property :key kw)))
|
||||||
|
(when (and (string-prefix-p "ROAM_" key)
|
||||||
|
(not (member key org-roam-doctor--supported-roam-properties)))
|
||||||
|
(push
|
||||||
|
`(,(org-element-property :begin kw)
|
||||||
|
,(concat "Possible mispelled key: "
|
||||||
|
(prin1-to-string key)
|
||||||
|
"\nOrg-roam supports the following keys: "
|
||||||
|
(s-join ", " org-roam-doctor--supported-roam-properties)))
|
||||||
|
reports)))))
|
||||||
|
reports))
|
||||||
|
|
||||||
(defun org-roam-doctor-check-tags (ast)
|
(defun org-roam-doctor-check-tags (ast)
|
||||||
"Checker for detecting invalid #+ROAM_TAGS.
|
"Checker for detecting invalid #+ROAM_TAGS.
|
||||||
AST is the org-element parse tree."
|
AST is the org-element parse tree."
|
||||||
|
Reference in New Issue
Block a user