David Maus <maus.da...@gmail.com> writes:

> Matt Lundin wrote:
>>Nathaniel Flath <flat0...@gmail.com> writes:
>
>>> I have a todo state, PENDING, that I organize tasks that I cannot
>>> perform immediately.  Is there a way to configure org-todoconfigure so
>>> that when a task is switched to PENDING, if it has a scheduled date
>>> that date is removed?
>
>>You could use the hook org-after-todo-state-change-hook. E.g.
>
>>--8<---------------cut here---------------start------------->8---
>>(defun my-org-pending-remove-deadline ()
>>  (when (equal (org-entry-get nil "TODO") "PENDING")
>>    (org-remove-timestamp-with-keyword org-deadline-string)))
>
>>(add-hook 'org-after-todo-state-change-hook 'my-org-pending-remove-deadline)
>>--8<---------------cut here---------------end--------------->8---
>
> You can actually skip the `org-entry-get' as "The new state (a string
> with a TODO keyword, or nil) is available in the Lisp variable
> `state'"[1].
>
> ,----
> | (defun my-org-pending-remove-deadline ()
> |   (when (string= state "PENDING")
> |     (org-remove-timestamp-with-keyword org-deadline-string)))
> `----

Good to know. Thanks!

- Matt


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to