org-mode: creation time range from effort estimate

。_饼干妹妹 提交于 2019-11-30 10:25:42

To add a scheduled timestamp, use: M-x org-schedule

To add effort as a range to an existing timestamp, using the standard effort format (e.g., "0 0:10 0:30 1:00 2:00 3:00 4:00") [see http://orgmode.org/manual/Filtering_002flimiting-agenda-items.html ], the following function should do the job. NOTE org-mode version 7 uses all lowercase for the org-element-property property drawer, whereas org-mode version 8 uses all capitals -- e.g., (org-element-property :EFFORT (org-element-at-point))


org-schedule-effort was tested with org-mode version 8.2.5.c using the following example task -- not using h or m for effort. Emacs rounds 00 01 02 03 04 05 06 07 08 09 to 0 1 2 3 4 5 6 7 8 9 and timestamp format requires the former -- therefore, we need to concatenate a 0 to the beginning if less than 10.

* TODO Sample todo
  SCHEDULED: <2014-04-18 Fr 10:00>
  :PROPERTIES:
  :Effort:  1:15
  :END:

(defun org-schedule-effort ()
(interactive)
  (save-excursion
    (org-back-to-heading t)
    (let* (
        (element (org-element-at-point))
        (effort (org-element-property :EFFORT element))
        (scheduled (org-element-property :scheduled element))
        (ts-year-start (org-element-property :year-start scheduled))
        (ts-month-start (org-element-property :month-start scheduled))
        (ts-day-start (org-element-property :day-start scheduled))
        (ts-hour-start (org-element-property :hour-start scheduled))
        (ts-minute-start (org-element-property :minute-start scheduled)) )
      (org-schedule nil (concat
        (format "%s" ts-year-start)
        "-"
        (if (< ts-month-start 10)
          (concat "0" (format "%s" ts-month-start))
          (format "%s" ts-month-start))
        "-"
        (if (< ts-day-start 10)
          (concat "0" (format "%s" ts-day-start))
          (format "%s" ts-day-start))
        " "
        (if (< ts-hour-start 10)
          (concat "0" (format "%s" ts-hour-start))
          (format "%s" ts-hour-start))
        ":"
        (if (< ts-minute-start 10)
          (concat "0" (format "%s" ts-minute-start))
          (format "%s" ts-minute-start))
        "+"
        effort)) )))
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!