summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-10-13 16:21:14 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2013-10-13 16:21:14 (GMT)
commitf37f3596a26758760518942098ea4b93b43ecaf2 (patch)
treeebfaec0fc115fc18a545d4b1f0f08a8b3db930f1
parentfd5a4f7d3660ff1a9102eaf6d825a5a60c982d9c (diff)
parent92c2ccb1fb438064453c60ff215adad1c213218d (diff)
downloadorg-mode-f37f3596a26758760518942098ea4b93b43ecaf2.zip
org-mode-f37f3596a26758760518942098ea4b93b43ecaf2.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-element.el21
-rw-r--r--testing/lisp/test-org-element.el19
2 files changed, 29 insertions, 11 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 62461f7..f57ef1c 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3660,12 +3660,12 @@ CONTENTS is nil."
(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)))
+ (case (org-element-property :warning-type timestamp)
+ (first "--")
+ (all "-"))
+ (let ((val (org-element-property :warning-value timestamp)))
(and val (number-to-string val)))
- (case (org-element-property :warninger-unit timestamp)
+ (case (org-element-property :warning-unit timestamp)
(hour "h") (day "d") (week "w") (month "m") (year "y"))))
(build-ts-string
;; Build an Org timestamp string from TIME. ACTIVEP is
@@ -3685,11 +3685,12 @@ CONTENTS is nil."
(format "\\&-%02d:%02d" hour-end minute-end)
nil nil ts)))
(unless activep (setq ts (format "[%s]" (substring ts 1 -1))))
- (when (org-string-nw-p repeat-string)
- (setq ts (concat (substring ts 0 -1)
- " "
- repeat-string
- (substring ts -1))))
+ (dolist (s (list repeat-string warning-string))
+ (when (org-string-nw-p s)
+ (setq ts (concat (substring ts 0 -1)
+ " "
+ s
+ (substring ts -1)))))
;; Return value.
ts)))
(type (org-element-property :type timestamp)))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index b124f71..7d36ba5 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -2456,7 +2456,7 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
;; Diary.
(should (equal (org-test-parse-and-interpret "<%%diary-float t 4 2>")
"<%%diary-float t 4 2>\n"))
- ;; Timestamp with repeater interval.
+ ;; Timestamp with repeater interval, with delay, with both.
(should (equal (org-test-parse-and-interpret "<2012-03-29 thu. +1y>")
"<2012-03-29 thu. +1y>\n"))
(should
@@ -2467,6 +2467,23 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
(:type active :year-start 2012 :month-start 3 :day-start 29
:repeater-type cumulate :repeater-value 1 :repeater-unit year))
nil)))
+ (should
+ (string-match
+ "<2012-03-29 .* -1y>"
+ (org-element-timestamp-interpreter
+ '(timestamp
+ (:type active :year-start 2012 :month-start 3 :day-start 29
+ :warning-type all :warning-value 1 :warning-unit year))
+ nil)))
+ (should
+ (string-match
+ "<2012-03-29 .* \\+1y -1y>"
+ (org-element-timestamp-interpreter
+ '(timestamp
+ (:type active :year-start 2012 :month-start 3 :day-start 29
+ :warning-type all :warning-value 1 :warning-unit year
+ :repeater-type cumulate :repeater-value 1 :repeater-unit year))
+ nil)))
;; Timestamp range with repeater interval
(should (equal (org-test-parse-and-interpret
"<2012-03-29 Thu +1y>--<2012-03-30 Thu +1y>")