diff options
authorNicolas Goaziou <>2013-10-13 08:20:58 (GMT)
committer Nicolas Goaziou <>2013-10-13 08:20:58 (GMT)
commitfd5a4f7d3660ff1a9102eaf6d825a5a60c982d9c (patch)
parentbe3dad300feca316cbcd593e054fcbc939cdb280 (diff)
parent11514badc127a23be25c12394a5084f0e83e8f09 (diff)
Merge branch 'maint'
2 files changed, 38 insertions, 4 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 807fdb4..62461f7 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3549,7 +3549,12 @@ beginning position."
"Parse time stamp at point.
Return a list whose CAR is `timestamp', and CDR a plist with
-`:type', `:begin', `:end', `:value' and `:post-blank' keywords.
+`:type', `:raw-value', `:year-start', `:month-start',
+`:day-start', `:hour-start', `:minute-start', `:year-end',
+`:month-end', `:day-end', `:hour-end', `:minute-end',
+`:repeater-type', `:repeater-value', `:repeater-unit',
+`:warning-type', `:warning-value', `:warning-unit', `:begin',
+`:end', `:value' and `:post-blank' keywords.
Assume point is at the beginning of the timestamp."
@@ -3579,7 +3584,7 @@ Assume point is at the beginning of the timestamp."
(t 'inactive)))
(and (not diaryp)
- (string-match "\\([.+]?\\+\\)\\([0-9]+\\)\\([hdwmy]\\)>"
+ (string-match "\\([.+]?\\+\\)\\([0-9]+\\)\\([hdwmy]\\)"
@@ -3591,6 +3596,15 @@ Assume point is at the beginning of the timestamp."
(case (string-to-char (match-string 3 raw-value))
(?h 'hour) (?d 'day) (?w 'week) (?m 'month) (t 'year)))))
+ (warning-props
+ (and (not diaryp)
+ (string-match "\\(-\\)?-\\([0-9]+\\)\\([hdwmy]\\)" raw-value)
+ (list
+ :warning-type (if (match-string 1 raw-value) 'first 'all)
+ :warning-value (string-to-number (match-string 2 raw-value))
+ :warning-unit
+ (case (string-to-char (match-string 3 raw-value))
+ (?h 'hour) (?d 'day) (?w 'week) (?m 'month) (t 'year)))))
year-start month-start day-start hour-start minute-start year-end
month-end day-end hour-end minute-end)
;; Parse date-start.
@@ -3627,7 +3641,8 @@ Assume point is at the beginning of the timestamp."
:begin begin
:end end
:post-blank post-blank)
- repeater-props)))))
+ repeater-props
+ warning-props)))))
(defun org-element-timestamp-interpreter (timestamp contents)
"Interpret TIMESTAMP object as Org syntax.
@@ -3643,6 +3658,15 @@ CONTENTS is nil."
(and val (number-to-string val)))
(case (org-element-property :repeater-unit timestamp)
(hour "h") (day "d") (week "w") (month "m") (year "y"))))
+ (warning-string
+ (concat
+ (and (eq (org-element-property :warninger-type timestamp) 'first)
+ "-")
+ "-"
+ (let ((val (org-element-property :warninger-value timestamp)))
+ (and val (number-to-string val)))
+ (case (org-element-property :warninger-unit timestamp)
+ (hour "h") (day "d") (week "w") (month "m") (year "y"))))
;; Build an Org timestamp string from TIME. ACTIVEP is
;; non-nil when time stamp is active. If WITH-TIME-P is
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index ea4f649..b124f71 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1921,11 +1921,21 @@ Outside list"
(let ((timestamp (org-element-context)))
(or (org-element-property :hour-end timestamp)
(org-element-property :minute-end timestamp)))))
- ;; With repeater.
+ ;; With repeater, warning delay and both.
(eq 'catch-up
(org-test-with-temp-text "<2012-03-29 Thu ++1y>"
(org-element-property :repeater-type (org-element-context)))))
+ (should
+ (eq 'first
+ (org-test-with-temp-text "<2012-03-29 Thu --1y>"
+ (org-element-property :warning-type (org-element-context)))))
+ (should
+ (equal '(cumulate all)
+ (org-test-with-temp-text "<2012-03-29 Thu +1y -1y>"
+ (let ((ts (org-element-context)))
+ (list (org-element-property :repeater-type ts)
+ (org-element-property :warning-type ts))))))
;; Timestamps are not planning elements.
(org-test-with-temp-text "SCHEDULED: <2012-03-29 Thu 16:40>"