浏览代码

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.
Nicolas Goaziou 12 年之前
父节点
当前提交
a51b8fa308
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 7 4
      lisp/org-element.el
  2. 2 1
      testing/lisp/test-org-element.el

+ 7 - 4
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))

+ 2 - 1
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."