summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-11-25 00:03:51 (GMT)
committer Nicolas Goaziou <n.goaziou@gmail.com>2012-11-25 00:16:39 (GMT)
commita51b8fa3085596f3cc241ed82bb2da55d86c87e1 (patch)
tree34dd804784c69ad0dd25dac967d97a95eb0fd4ba
parentb7053b5f9c42095ea3bd636d0e7eb736abf8e730 (diff)
downloadorg-mode-a51b8fa3085596f3cc241ed82bb2da55d86c87e1.zip
org-mode-a51b8fa3085596f3cc241ed82bb2da55d86c87e1.tar.gz
org-element: Fix timestamp interpreter
* lisp/org-element.el (org-element-timestamp-interpreter): Fix timestamp interpreter when raw value isn't available. * testing/lisp/test-org-element.el: Update test.
-rw-r--r--lisp/org-element.el11
-rw-r--r--testing/lisp/test-org-element.el3
2 files changed, 9 insertions, 5 deletions
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 4c61af6..6f648ed 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3562,10 +3562,13 @@ CONTENTS is nil."
(and hour-start minute-start)
(and time-range-p hour-end)
(and time-range-p minute-end)
- (concat (case (org-element-property :repeater-type timestamp)
- (cumulate "+") (catch-up "++") (restart ".+"))
- (org-element-property :repeater-value timestamp)
- (org-element-property :repeater-unit timestamp)))))
+ (concat
+ (case (org-element-property :repeater-type timestamp)
+ (cumulate "+") (catch-up "++") (restart ".+"))
+ (let ((val (org-element-property :repeater-value timestamp)))
+ (and val (number-to-string val)))
+ (case (org-element-property :repeater-unit timestamp)
+ (hour "h") (day "d") (week "w") (month "m") (year "y"))))))
((active-range inactive-range)
(let ((minute-start (org-element-property :minute-start timestamp))
(minute-end (org-element-property :minute-end timestamp))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 6069260..a00e9d9 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -2251,7 +2251,8 @@ DEADLINE: <2012-01-01> SCHEDULED: <2012-01-01> CLOSED: [2012-01-01]\n"))))
(org-element-timestamp-interpreter
'(timestamp
(:type active :year-start 2012 :month-start 3 :day-start 29
- :repeater-type cumulate :repeater-value "1y")) nil))))
+ :repeater-type cumulate :repeater-value 1 :repeater-unit year))
+ nil))))
(ert-deftest test-org-element/verse-block-interpreter ()
"Test verse block interpretation."