12

如果对于 org-mode 中的某些任务,子任务可以继承主任务的截止日期,那将非常方便。如果我尚未为子任务指定截止日期,则应发生此行为。通过这种方式,所有子任务都将显示在我的 org-agenda 视图中,并具有易于操作的适当截止日期。

4

6 回答 6

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

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

(define-key org-mode-map (kbd "C-c s") 'my-org-insert-sub-task)

此外,您可能会发现这些设置很有用:

(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks 'invisible)
于 2012-01-19T02:43:09.153 回答
2

最近,在 org-mode 邮件列表上提出并回答了这个问题。我在这里添加该讨论,希望有人会发现它有用:

http://article.gmane.org/gmane.emacs.orgmode/49215

我已在此提交中将该代码添加到我的 .emacs 中:

https://github.com/vedang/emacs-config/commit/1cb6c774a991d50853134d8085ca61dd12585993

于 2012-04-11T13:25:48.653 回答
1

这是适用于 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)
于 2018-07-05T17:40:29.970 回答
0

DEADLINE 是这些属性之一,默认情况下不继承。您可以通过自定义变量来更改它org-use-property-inheritance

于 2011-08-10T11:06:34.300 回答
0

另一种方法是org-agenda-bulk-actionorg-agenda-mode.

  1. 定义stuck-projects为尚未有截止日期且尚未计划的 TODO 标题:Defining unscheduled todos as stand projects in Emacs Org-Mode
  2. M-x org-agenda-list-stuck-projects. 这将显示一个没有截止日期的 TODO 标题列表。
  3. m标记您要添加截止日期的条目。
  4. B调用org-agenda-bulk-action.
  5. d为所有这些分配一个截止日期。
于 2014-05-13T04:38:40.093 回答
0

Org-mode 能够继承截止日期等标签,但默认情况下org-entry-get不这样做。这是确保DEADLINE始终继承的建议。

(defvar inherit-override nil)
(defun org-entry-get-inherit-deadline (orig-fun pom property &optional inherit &rest args)
  "Call ORIG-FUN with POM, but if PROPERTY is `DEADLINE', set INHERIT.

Passes through remaining ARGS.

Sets inherit-override variable which stops infinite loops."
  (when (and (eq inherit nil)
             (string= property "DEADLINE")
             (not inherit-override))
    (setq inherit t))
  (let ((inherit-override t))
    (apply orig-fun pom property inherit args)))

(advice-add 'org-entry-get :around #'org-entry-get-inherit-deadline)
于 2018-04-23T22:29:42.883 回答