emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Re: Bug: org-deadline drops warning periods from TIME [9.4.6 (9.


From: Ihor Radchenko
Subject: [PATCH] Re: Bug: org-deadline drops warning periods from TIME [9.4.6 (9.4.6-10-gee652a-elpaplus @ /home/fap/.emacs.d/elpa/org-plus-contrib-20210712/)]
Date: Mon, 20 Dec 2021 22:29:33 +0800

erimius@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.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@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-84abbd2915c8@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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]