Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way for subtasks to inherit deadlines in org-mode?

Tags:

emacs

org-mode

It would be really convenient if for certain tasks in org-mode, the subtasks could inherit the deadline of the main task. This behavior should occur in case I have not already specified a deadline for the subtask. In this way, all the subtasks would show up in my org-agenda view, with proper deadlines which are easily manipulatable.

like image 755
vedang Avatar asked Feb 02 '11 08:02

vedang


2 Answers

Here's advice that works for recent versions of Org 9, unlike my previous answer which stopped working at some point.

(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)
like image 123
Michael Hoffman Avatar answered Nov 07 '22 11:11

Michael Hoffman


DEADLINE is one of these properties, that are not inherited by default. You can change that by customizing the variable org-use-property-inheritance

like image 23
Manuel Batsching Avatar answered Nov 07 '22 11:11

Manuel Batsching