org-mode: creation time range from effort estimate

后端 未结 1 1870
野性不改
野性不改 2020-12-16 07:16

I would like to use org-mode not with a GTD-like system but rather as a planner/scheduler, scheduling/timestamping every captured task on capture or refile. In such a system

相关标签:
1条回答
  • 2020-12-16 07:48

    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)) )))
    
    0 讨论(0)
提交回复
热议问题