ORG-MODE-在特定日期触发TODO状态?


9

与其每天早上手动检查报价文件或日历,不如如何创建一个触发器,将某个日期的项目状态设置为TODO?

Answers:


5

不是直接的答案,但是您可以使用Org的支持来规定截止日期和安排时间。

您可以创建TODO项目并为其指定排定的日期,在组织中这意味着您计划执行任务的日期-以及何时开始显示在您的议程中。(如果您尚未使用组织议程视图,则值得进行调查!)

根据您的需要,您还可以指定截止日期。例如:在星期五创建一个待办事项,在您实际要查看时在下一个星期三安排;并为其指定下一个星期五的截止日期。


7

这是我每天早晨都会使用的方法,以梳理所有待办事项,如果过期,则将日期更改为今天,如果今天到期,则将其从下一动作更改为活动。这是我使用了一年的日历的自定义解决方案,因此毫无疑问需要您自己进行一些自定义。我的回忆是,有一个变化org-deadline,从org-mode第7版和8,我可以用我的设置以前的版本。当前版本可能需要其他参数或其他内容-如果您需要其他帮助,请告诉我,我会在接下来的几天内继续处理。

我使用的正则表达式考虑到标题有两个星号,将位于缓冲区的左对齐位置。您自己的设置可能需要修改正则表达式。

(defun org-carry-forward-uncompleted-tasks ()
"Carry forward uncompleted tasks."
(interactive)
  (save-excursion
    (goto-char (point-max))
    (while (re-search-backward "^\\*\\* Active" nil t)
      (unless (org-at-heading-p)
        (org-back-to-heading t))
      (let* (
          (element (org-element-at-point))
          (todo-state (org-element-property :todo-keyword element))
          (deadline (org-element-property :deadline element))
          (deadline-time-stamp
            (when deadline
              (time-to-days
                (org-time-string-to-time
                  (org-element-property :raw-value deadline)))))
          (today (time-to-days (current-time))) )
        (when
            (and
              deadline-time-stamp
              (> today deadline-time-stamp) ;; deadline is overdue
              (string= todo-state "Active") ) ;; todo-state equals "X"
          (org-deadline nil ".") )))))

(defun org-make-active-today ()
"Change task from Next Action to Active if deadline is less than or equal to today."
(interactive)
  (save-excursion
    (goto-char (point-max))
    (while (re-search-backward "^\\*\\* Next Action" nil t)
      (unless (org-at-heading-p)
        (org-back-to-heading t))
      (let* (
          (element (org-element-at-point))
          (todo-state (org-element-property :todo-keyword element))
          (deadline (org-element-property :deadline element))
          (deadline-time-stamp
            (when deadline
              (time-to-days
                (org-time-string-to-time
                  (org-element-property :raw-value deadline) ))))
          (today (time-to-days (current-time))) )
        (when
            (and
              deadline-time-stamp
              (>= today deadline-time-stamp) ;; deadline less than or equal to today
              (string= todo-state "Next Action")) ;; todo-state equals "X"
          (org-deadline nil ".")
          (org-todo "Active") )))))
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.