From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: Re: Remove scheduled date when switch TODO states Date: Mon, 22 Feb 2010 23:19:55 +0100 Message-ID: <87pr3wlxpw.wl%maus.david@gmail.com> References: <5e3a506e1002201213i1e14bad3q844adeb6fa04cc4c@mail.gmail.com> <87sk8tcfb5.fsf@fastmail.fm> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============1048616907==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NjgdI-0007W3-2S for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:20:04 -0500 Received: from [140.186.70.92] (port=57672 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NjgdG-0007VJ-Ra for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:20:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NjgdF-0008T4-Lf for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:20:02 -0500 Received: from ey-out-1920.google.com ([74.125.78.147]:28871) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NjgdE-0008SG-Vg for emacs-orgmode@gnu.org; Mon, 22 Feb 2010 17:20:01 -0500 Received: by ey-out-1920.google.com with SMTP id 3so926292eyh.2 for ; Mon, 22 Feb 2010 14:19:59 -0800 (PST) In-Reply-To: <87sk8tcfb5.fsf@fastmail.fm> 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: Matt Lundin Cc: emacs-orgmode@gnu.org --===============1048616907== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Mon_Feb_22_23:19:50_2010-1"; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Mon_Feb_22_23:19:50_2010-1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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-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-deadlin= e) >--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))) `---- Another solution: use `org-trigger-hook' and `org-schedule': ,---- | (defvar dmj/org-pending-keywords '("PENDING") | "List of keywords denoting pending state of an headline.") |=20 | (defun dmj/org-remove-schedule-when-pending (plist) | "Remove schedule when todo state changes to pending." | (let ((type (plist-get plist :type)) | (to (plist-get plist :to))) | (when (and (eq type 'todo-state-change) | (member to dmj/org-pending-keywords)) | (org-schedule 'remove)))) `---- HTH -- David [1] http://orgmode.org/worg/org-configs/org-hooks.php#sec-1.13 --=20 OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... maus.david@gmail.com --pgp-sign-Multipart_Mon_Feb_22_23:19:50_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAkuDAwoACgkQma24O1pEeOZy7QEAh1dR2Gv/Tou35MlKXwrSym6S vp1EVKV8j+UO3Qp3ggMA/2fy0FGFkAg52ESeFcNJg2gOzfL8IxxQLf8FAFMgj5FZ =dpkS -----END PGP SIGNATURE----- --pgp-sign-Multipart_Mon_Feb_22_23:19:50_2010-1-- --===============1048616907== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1048616907==--