Search code examples
emacsorg-mode

Remove deadline shortcut?


Is there an easy way (with a keyboard shortcut) to remove a deadline or a schedule without actually closing the task?


Solution

  • Shortcut: C-u C-c C-s.

    Why this works

    1. to find all methods with schedule, do C-h a, enter "schedule". There seems to be only

      org-schedule is an interactive compiled Lisp function in
      ‘../elpa/org-9.0.9/org.el’.
      
      (org-schedule ARG &optional TIME)
      
      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".
      
    2. so you need to call org-schedule "with one universal prefix argument". See https://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Command-Arguments.html. The universal prefix argument is just C-u. In code, this is handled at org.el in org--deadline-or-schedule:

      (pcase arg
        (`(4)
         (when (and old-date log)
       (org-add-log-setup (if deadline? 'deldeadline 'delschedule)
                  nil old-date log))
         (org-remove-timestamp-with-keyword keyword)
         (message (if deadline? "Item no longer has a deadline."
            "Item is no longer scheduled.")))
      

    PS: The Emacs-geeks live at https://emacs.stackexchange.com.