7

What is the reasoning behind the design of not inheriting the SCHEDULED and priority properties?

Any notable use cases to support this behavior?

On the contrary, actually inheriting SCHEDULED (or DEADLINE for that matter) and priority properties makes perfect sense to me.

For instance, if an entry is SCHEDULED and thus is appearing in the week agenda, adding a sub-item to it will automatically bring that item to agenda replacing the parent. This will prevent the parent from falling out of attention. In the current design you may loose a DEADLINE task forever by adding a sub-task to it without scheduling it.

  • 2
    I agree this feature is weirdly lacking. Are you trying to add this feature and getting stuck somewhere in the code? – purple_arrows Apr 13 '18 at 21:22
  • 1
    The function that handles this stuff is `org-entry-get`. For values in `org-special-properties` (including `SCHEDULED` and `DEADLINE`) it uses `org-entry-properties`, which doesn’t support inheritance. For other values it uses `org-entry-get-with-inheritance`. So one way to add support would be to rewrite the first function. Another way would be to rewrite the second function to handle `org-special-properties` and take out the first case. – purple_arrows Apr 13 '18 at 21:26
  • @purple_arrows has there been any development on this front since 2018? – Matthew Piziak Jun 12 '19 at 18:24

1 Answers1

1

Not sure if this is still relevant in 2020, but I needed something similar and so I modified org-get-entry to allow for inheriting special properties (by passing 't to INHERIT). Leaving this here in case someone needs it

(defun org-entry-get-special-with-inheritance (property &optional literal-nil)
  "Same as org's `org-entry-get-with-inheritance' but for special properties"
  (move-marker org-entry-property-inherited-from nil)
  (org-with-wide-buffer
   (let (value)
     (catch 'exit
       (while t
     (let ((v (org-entry-properties nil property)))
       (cond
        (v
       (setq value (cdr (assoc-string property v)))
         (org-back-to-heading-or-point-min t)
         (move-marker org-entry-property-inherited-from (point))
         (throw 'exit nil))
        ((org-up-heading-or-point-min))
        (t
         (let ((global (org--property-global-or-keyword-value property literal-nil)))
           (cond ((not global))
             (value (setq value (concat global " " value)))
             (t (setq value global))))
         (throw 'exit nil))))))
     (if literal-nil value (org-not-nil value)))))

(defun org-entry-get (pom property &optional inherit literal-nil)
    "Same as org's `org-get-entry' but allows inheriting special properties"
  (org-with-point-at pom
    (let ((special (member-ignore-case property (cons "CATEGORY" org-special-properties)))
          (inherit (and inherit
                        (or (not (eq inherit 'selective)) (org-property-inherit-p property)))))
      (cond
       ((and special (not inherit))
        (cdr (assoc-string property (org-entry-properties nil property))))
       ((and special inherit)
        (org-entry-get-special-with-inheritance property literal-nil))
       ((and (not special) inherit)
        (org-entry-get-with-inheritance property literal-nil))
       (t
        (let* ((local (org--property-local-values property literal-nil))
               (value (and local (mapconcat #'identity (delq nil local) " "))))
          (if literal-nil value (org-not-nil value))))))))
Tohiko
  • 1,589
  • 1
  • 10
  • 22