0

I'd like to try a new approach to my org-mode and schedule tasks for today every morning. I usually set them to TODO only, but scheduling would also allow me to see how much I procrastinate some of them.

Is there a way to bind those two, so assign a shortcut to switch to TODO and assign SCHEDULED for todays date? Doing this manually is a bit too tedious.

3

Bind function

(defun my-org-switch-to-todo-and-schedule-for-today ()
  "Set subtree TODO and schedule for today."
  (interactive)
  (unless (org-before-first-heading-p)
    (org-todo "TODO")
    (org-schedule nil "+0d")))

to a key of your choice.

The same functionality can be triggerd from the agenda with function

(defun my-org-agenda-switch-to-todo-and-schedule-for-today ()
  "Set item as TODO and schedule for today via agenda."
  (interactive)
  (when (eq major-mode 'org-agenda-mode)
    (org-agenda-todo "TODO")
    (org-agenda-schedule nil "+0d")))
  • This works great, but seems not to work when I'm in agenda mode. I didn't mention that, but thats how I would actually want to use this. I'll mark entries from my NEXT list to my TODAY list this way. – kajman Jan 20 '18 at 15:40
  • Please check out the other function which has been added in the answer section. – Marco Wahl Jan 20 '18 at 16:05
  • When I try the other function from agenda view I get message "Before first headline at position 7895 in buffer Org Agenda" and nothing else happens. – kajman Jan 20 '18 at 18:41
  • The proposed my-org-agenda-switch-to-todo-and-schedule-for-today does its job on my machine. Please check if you copied the function correctly. In particular note the use of "org-agenda-todo" instead of "org-todo". (The latter has been used in the first function.) – Marco Wahl Jan 21 '18 at 12:12
  • 1
    My bad, I modifed the first entry instead of copying the new one making the mistake you mentioned in comment :) now it works, thanks a lot! – kajman Jan 22 '18 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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