2

Hello everybody it is quite easy question.

I'm using org-mobile so it synchronize my android agenda with org mode.

When I use org-deadline (C-c C-d) and I choose today, the format will look like this: DEADLINE: <2015-08-03 Pzt>,

I just want it to make all deadlines always be at 10 am instead, like this: DEADLINE: <2015-08-03 Pzt 10:00>. I would also like the same behaviour with org-schedule (C-c C-s).

How can achieve this?

1
  • You can type in a date with time at the prompt like this: January 5, 2015 10:00. You can also insert the current date programmatically with a specified time like this: (org-deadline nil "10:00") or (org-scheduled nil "10:00"). Look at the doc-string for org-read-date to familiarize yourself with the acceptable formats -- M-x describe-function RET org-read-date RET.
    – lawlist
    Commented Aug 3, 2015 at 14:10

2 Answers 2

1

org-deadline works by calling org-add-planning-info, with org-deadline's input (nil if you call it with C-c C-d) and gets a default time from org-parse-time-string, which is hard-coded to today at 00:00. So there is no variable we can easily change to set the default time.

This default time is then passed to org-read-date which gets the user input and does take an argument letting us set our own default time. Thus, we can advise org-deadline to call a different version of org-read-date whose default time is some value we set:

(require 'cl-lib)

(defvar org-deadline-default-time "10:00"
  "The default time for deadlines.")


(defun advise-deadline-default-time (deadline-func arg &optional time)
  (let ((old-time (symbol-function #'org-read-date)))
    (cl-letf (((symbol-function #'org-read-date)
               #'(lambda (&optional a b c d default-time f g)
                   (let ((default-time (or default-time
                                           org-deadline-default-time)))
                     (apply old-time a b c d f default-time g)
                     ))))
      (apply deadline-func arg time)
    )))

(advice-add #'org-deadline :around #'advise-deadline-default-time)
3
  • I don't know. It does not work directly when I copied it. Nothing changed When I used C-c C-d Commented Aug 4, 2015 at 9:38
  • I've edited in some bug fixes. It's working for me except with when there is already a deadline on the entry.
    – erikstokes
    Commented Aug 5, 2015 at 1:14
  • Thanks for help as you say its work like you say, now I am reading Lisp book, When I finish my first code fixing will be for this thanks for help Best Regards. Commented Aug 21, 2015 at 11:42
0

I have just find orgbox mode which works like how described in question.

Here's a picture which describe how it is work

orgbox-pic

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.