branch: externals/org
commit 3cbd9f423385bf725dc964a5cff573bba17db3ff
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    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
---
 lisp/org-lint.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index 7a9195cb63..5114902942 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -1436,6 +1436,19 @@ AST is the buffer parse tree."
         (unless (equal expected actual)
           (list (org-element-property :begin timestamp)
                 (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
 
@@ -1706,6 +1719,10 @@ AST is the buffer parse tree."
   "Report malformed timestamps."
   #'org-lint-timestamp-syntax
   :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)
 

Reply via email to