子任务是否有办法在org-mode中继承最后期限?

ved*_*ang 12 emacs org-mode

如果对于org-mode中的某些任务,子任务可以继承主任务的最后期限,那将非常方便.如果我还没有指定子任务的截止日期,则会发生此行为.通过这种方式,所有子任务都会显示在我的组织议程视图中,并且适当的截止日期很容易操作.

Joe*_*ris 5

添加子任务的功能怎么样?如果子任务的子任务有一个,则为子任务添加一个截止日期:

(defun my-org-insert-sub-task ()
  (interactive)
  (let ((parent-deadline (org-get-deadline-time nil)))
    (org-goto-sibling)
    (org-insert-todo-subheading t)
    (when parent-deadline
      (org-deadline nil parent-deadline))))
Run Code Online (Sandbox Code Playgroud)

不要忘记将它绑定到一个键:

(define-key org-mode-map (kbd "C-c s") 'my-org-insert-sub-task)
Run Code Online (Sandbox Code Playgroud)

您也可能会发现这些设置很有用:

(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks 'invisible)
Run Code Online (Sandbox Code Playgroud)


Mic*_*man 5

这是适用于最新版本的 Org 9 的建议,与我之前的答案不同,它在某个时候停止工作。

(defun org-entry-properties-inherit-deadline (orig-fun &optional pom which)
  "Call ORIG-FUN with POM, but if WHICH is `DEADLINE' do it recursively."

  (if (string= which "DEADLINE")
      (org-with-point-at pom
        (let (value)
          (while (not (or (setq value (funcall orig-fun (point) which))
                          (not (org-up-heading-safe)))))
          value)
    (funcall orig-fun pom which))))
(advice-add 'org-entry-properties :around #'org-entry-properties-inherit-deadline)
Run Code Online (Sandbox Code Playgroud)