mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-21 06:55:35 +00:00
org-lint: Add checker for misspelled export options in properties
* lisp/org-lint.el (org-lint-export-option-keywords): New linter checking export properties without EXPORT_. Link: https://orgmode.org/list/87ttv7kp2j.fsf@k-7.ch
This commit is contained in:
parent
739c8989a7
commit
1ec3a43c58
@ -742,6 +742,29 @@ Use \"export %s\" instead"
|
||||
reports))))))))
|
||||
reports))
|
||||
|
||||
(defun org-lint-export-option-keywords (ast)
|
||||
"Check for options keyword properties without EXPORT_."
|
||||
(require 'ox)
|
||||
(let (options reports)
|
||||
(dolist (opt org-export-options-alist)
|
||||
(when (stringp (nth 1 opt))
|
||||
(cl-pushnew (nth 1 opt) options :test #'equal)))
|
||||
(dolist (backend org-export-registered-backends)
|
||||
(dolist (opt (org-export-backend-options backend))
|
||||
(when (stringp (nth 1 opt))
|
||||
(cl-pushnew (nth 1 opt) options :test #'equal))))
|
||||
(org-element-map ast 'node-property
|
||||
(lambda (node)
|
||||
(when (member
|
||||
(org-element-property :key node)
|
||||
options)
|
||||
(push (list (org-element-property :post-affiliated node)
|
||||
(format "Potentially misspelled option \"%s\". Consider \"EXPORT_%s\"."
|
||||
(org-element-property :key node)
|
||||
(org-element-property :key node)))
|
||||
reports))))
|
||||
reports))
|
||||
|
||||
(defun org-lint-invalid-macro-argument-and-template (ast)
|
||||
(let* ((reports nil)
|
||||
(extract-placeholders
|
||||
@ -1443,6 +1466,11 @@ AST is the buffer parse tree."
|
||||
#'org-lint-unknown-options-item
|
||||
:categories '(export) :trust 'low)
|
||||
|
||||
(org-lint-add-checker 'misspelled-export-option
|
||||
"Report potentially misspelled export options in properties."
|
||||
#'org-lint-export-option-keywords
|
||||
:categories '(export) :trust 'low)
|
||||
|
||||
(org-lint-add-checker 'invalid-macro-argument-and-template
|
||||
"Report spurious macro arguments or invalid macro templates"
|
||||
#'org-lint-invalid-macro-argument-and-template
|
||||
|
Loading…
Reference in New Issue
Block a user