7

With point on a TODO item in an .org file, I can use org-deadline (C-c C-d) to insert a deadline for the TODO. Is there any way to do this, and specify a repeater (e.g., +1w) at the same time?

Currently, I add a deadline using the method described above, then navigate to the end of the timestamp and manually add the repeater to the stamp. It doesn't seem like it will be possible from the org-deadline UI, because in that context +1w represents a delta ("a week from...") rather than a repeating interval. I have also looked through the documentation, and tried searching Emacs for commands of the form org*repeat*, but haven't come up with anything yet. However, it seems like a fairly common task, so I assumed there would be a related command.

1
  • 2
    If it were me, I would add an additional optional argument to the tail end of arguments for org-insert-time-stamp to handle things like +1w and I would have that function let-bind org-time-stamp-formats to have both the car and cdr handle this new situation (if it exists) -- i.e., default org-time-stamp-formats when new situation does not exist. I would modify org-deadline (and org-schedule) along with org-add-planning-info to account for the new situation. And, then I would do some debugging to see what else gets broken in the process and fix it. :)
    – lawlist
    Commented Dec 19, 2016 at 4:14

1 Answer 1

4

[See initial comment underneath the original question for a more robust idea that requires substantial hacking.]

(defun my-org-deadline (arg &optional time repeat)
(interactive "P")
  (let ((org-time-stamp-formats
          (if repeat
            `(,(concat "<%Y-%m-%d %a " repeat ">") .
              ,(concat "<%Y-%m-%d %a %H:%M " repeat ">"))
             org-time-stamp-formats)))
    (org-deadline arg time)))

Example Usage: (my-org-deadline nil "December 19, 2016 08:00" "+1w")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.