0

I am looking for an elisp function that will toggle scheduling for the current headline either to or not at all. Something like this:

If (SCHEDULED == Nil | SCHEDULED > <today>)
   Set SCHEDULED to <today>
Else if (SCHEDULED <= <today>)
   Set SCHEDULED to Nil
End If

The idea is to assign this function to a key combination (something like C-c C-t) so that I can quickly send (or remove) items from a Custom agenda view (the "Today" list). I would then font lock scheduled items in my projects.org file, to add a visual queue.

Thanks!

2

This feature is already built-in.

  • C-c C-s to add a scheduled date. The default is today, so if you want today, then just press the enter key after the foregoing keyboard shortcut.

  • C-u C-c C-s to remove a scheduled date.

Here is the doc-string for org-schedule:

Insert the SCHEDULED: string with a timestamp to schedule a TODO item.
With one universal prefix argument, remove any scheduling date from the item.
With two universal prefix arguments, prompt for a delay cookie.
With argument TIME, scheduled at the corresponding date.  TIME can
either be an Org date like "2011-07-24" or a delta like "+2d".

Here is the doc-string for org-agenda-schedule:

Schedule the item at point.
ARG is passed through to `org-schedule'.

Here is a link to the section in the manual entitled "Inserting deadlines or schedules":

http://orgmode.org/manual/Inserting-deadline_002fschedule.html

  • Thanks @lawlist. I was hoping to figure out how to use org-schedule in an elisp statement... It looks like it can be called with arguments? – Adam Aug 30 '16 at 21:36
  • 1
    (org-schedule 'remove) or (org-schedule nil TIME) or (org-schedule nil "") A blank string is will become the current date if so desired. – lawlist Aug 30 '16 at 21:51
  • Perfect! Do you also happen to know how to set the scheduled keyword to <today> using (org-schedule)? – Adam Aug 30 '16 at 21:55
  • 1
    My bad . . . I have an older version. This will work for newer versions of org-mode to remove a scheduled: (org-schedule '(4)) Can you educate me please regarding how org-mode knows that a keyword in the title relates to a task with a scheduled timestamp -- is there a variable or something where scheduled keywords are defined? – lawlist Aug 30 '16 at 21:59

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.