erim...@web.de writes: > * Reproduction > > Call ~org-deadline~ with a warning period like so: > > > (org-deadline nil "<2021-07-20 Tue -1d>") > ;; => DEADLINE: <2021-07-20 Tue> > > * Expected > > Deadline gets added with the warning period provided.
Can you try the attached patch? Also, note that warning period is still not supported when reading deadline interactively. Not sure if we need it though. Best, Ihor
>From 5ea33ca79c1c9fa60e960fcc4508fbfc5358b95f Mon Sep 17 00:00:00 2001 Message-Id: <5ea33ca79c1c9fa60e960fcc4508fbfc5358b95f.1640010497.git.yanta...@gmail.com> From: Ihor Radchenko <yanta...@gmail.com> Date: Mon, 20 Dec 2021 22:26:56 +0800 Subject: [PATCH] org--deadline-or-schedule: Allow warning period in TIME argument * lisp/org.el (org--deadline-or-schedule): Match warning period if provided in TIME arg. Fixes https://orgmode.org/list/83b84e24-bf18-8b2c-0e8e-84abbd291...@web.de --- lisp/org.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index ce4e08eab..29e1d4d0e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10652,7 +10652,13 @@ (defun org--deadline-or-schedule (arg type time) ;; We use `org-repeat-re' because we need ;; to tell the difference between a real ;; repeater and a time delta, e.g. "+2d". - (string-match org-repeat-re time) + (or (string-match org-repeat-re time) + ;; `org-repeat-re' is not sufficient + ;; to match warning periods. + (and (string-match-p org-ts-regexp-both time) + (string-match "\\([.+-]+[0-9]+[hdwmy]\ +\\(?:[/ ][-+]?[0-9]+[hdwmy]\\)?\\)" + time))) (match-string 1 time)) (and (org-string-nw-p old-date) (string-match "\\([.+-]+[0-9]+[hdwmy]\ -- 2.32.0