From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Lundin Subject: Re: Re: Remove scheduled date when switch TODO states Date: Mon, 22 Feb 2010 17:23:33 -0500 Message-ID: <87k4u4di56.fsf@fastmail.fm> References: <5e3a506e1002201213i1e14bad3q844adeb6fa04cc4c@mail.gmail.com> <87sk8tcfb5.fsf@fastmail.fm> <87pr3wlxpw.wl%maus.david@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NjggM-0000U5-1e for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:23:14 -0500 Received: from [140.186.70.92] (port=57845 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NjggK-0000TR-FJ for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:23:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NjggJ-0000Jm-Hx for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:23:12 -0500 Received: from out2.smtp.messagingengine.com ([66.111.4.26]:42748) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NjggJ-0000Ji-Fq for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:23:11 -0500 In-Reply-To: <87pr3wlxpw.wl%maus.david@gmail.com> (David Maus's message of "Mon, 22 Feb 2010 23:19:55 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: Matt Lundin , emacs-orgmode@gnu.org David Maus writes: > Matt Lundin wrote: >>Nathaniel Flath writes: > >>> I have a todo state, PENDING, that I organize tasks that I cannot >>> perform immediately.=C2=A0 Is there a way to configure org-todoconfigur= e 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-deadli= ne) >>--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=3D state "PENDING") > | (org-remove-timestamp-with-keyword org-deadline-string))) > `---- Good to know. Thanks! - Matt