mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-24 18:32:52 +00:00
org-lint: New checker for SCHEDULED/DEADLINE with inactive timestamp
* lisp/org-lint.el (org-lint-inactive-planning): Add new checker. Link: https://orgmode.org/list/875y5tlouo.fsf@localhost
This commit is contained in:
parent
7cc208af91
commit
3cbd9f4233
|
@ -1436,6 +1436,19 @@ AST is the buffer parse tree."
|
||||||
(unless (equal expected actual)
|
(unless (equal expected actual)
|
||||||
(list (org-element-property :begin timestamp)
|
(list (org-element-property :begin timestamp)
|
||||||
(format "Potentially malformed timestamp %s. Parsed as: %s" actual expected)))))))
|
(format "Potentially malformed timestamp %s. Parsed as: %s" actual expected)))))))
|
||||||
|
(defun org-lint-inactive-planning (ast)
|
||||||
|
"Report inactive timestamp in SCHEDULED/DEADLINE.
|
||||||
|
AST is the buffer parse tree."
|
||||||
|
(org-element-map ast 'planning
|
||||||
|
(lambda (planning)
|
||||||
|
(let ((scheduled (org-element-property :scheduled planning))
|
||||||
|
(deadline (org-element-property :deadline planning)))
|
||||||
|
(cond
|
||||||
|
((memq (org-element-property :type scheduled) '(inactive inactive-range))
|
||||||
|
(list (org-element-begin planning) "Inactive timestamp in SCHEDULED will not appear in agenda."))
|
||||||
|
((memq (org-element-property :type deadline) '(inactive inactive-range))
|
||||||
|
(list (org-element-begin planning) "Inactive timestamp in DEADLINE will not appear in agenda."))
|
||||||
|
(t nil))))))
|
||||||
|
|
||||||
;;; Checkers declaration
|
;;; Checkers declaration
|
||||||
|
|
||||||
|
@ -1706,6 +1719,10 @@ AST is the buffer parse tree."
|
||||||
"Report malformed timestamps."
|
"Report malformed timestamps."
|
||||||
#'org-lint-timestamp-syntax
|
#'org-lint-timestamp-syntax
|
||||||
:categories '(timestamp) :trust 'low)
|
:categories '(timestamp) :trust 'low)
|
||||||
|
(org-lint-add-checker 'planning-inactive
|
||||||
|
"Report inactive timestamps in SCHEDULED/DEADLINE."
|
||||||
|
#'org-lint-inactive-planning
|
||||||
|
:categories '(timestamp) :trust 'high)
|
||||||
|
|
||||||
(provide 'org-lint)
|
(provide 'org-lint)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue