forked from mirrors/org-mode
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. * testing/lisp/test-org.el (test-org/deadline): Add relevant tests. Fixes https://orgmode.org/list/87o85bl582.fsf@localhost
This commit is contained in:
parent
5c14a17344
commit
cdbb1c9633
12
lisp/org.el
12
lisp/org.el
|
@ -9742,10 +9742,14 @@ TYPE is either `deadline' or `scheduled'. See `org-deadline' or
|
|||
;; time stamp. We are going to insert it back at the end of
|
||||
;; the process.
|
||||
(repeater (or (and (org-string-nw-p 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)
|
||||
;; We use `org-ts-regexp-both' because we
|
||||
;; need to tell the difference between a
|
||||
;; real repeater and a time delta, e.g.
|
||||
;; "+2d".
|
||||
(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]\
|
||||
|
|
|
@ -5439,6 +5439,23 @@ Paragraph<point>"
|
|||
(org-deadline nil "<2012-03-29 Tue +2y>"))
|
||||
(replace-regexp-in-string
|
||||
"\\( [.A-Za-z]+\\) " "" (buffer-string) nil nil 1))))
|
||||
;; Preserve warning period.
|
||||
(should
|
||||
(equal "* H\nDEADLINE: <2021-07-20 -1d>"
|
||||
(org-test-with-temp-text "* H"
|
||||
(let ((org-adapt-indentation nil)
|
||||
(org-last-inserted-timestamp nil))
|
||||
(org-deadline nil "<2021-07-20 Tue -1d>"))
|
||||
(replace-regexp-in-string
|
||||
"\\( [.A-Za-z]+\\) " "" (buffer-string) nil nil 1))))
|
||||
(should
|
||||
(equal "* H\nDEADLINE: <2021-07-20 +1m -3d>"
|
||||
(org-test-with-temp-text "* H"
|
||||
(let ((org-adapt-indentation nil)
|
||||
(org-last-inserted-timestamp nil))
|
||||
(org-deadline nil "<2021-07-20 Tue +1m -3d>"))
|
||||
(replace-regexp-in-string
|
||||
"\\( [.A-Za-z]+\\) " "" (buffer-string) nil nil 1))))
|
||||
;; Remove CLOSED keyword, if any.
|
||||
(should
|
||||
(equal "* H\nDEADLINE: <2012-03-29>"
|
||||
|
|
Loading…
Reference in New Issue