emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <maus.david@gmail.com>
To: Matt Lundin <mdl@imapmail.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: Remove scheduled date when switch TODO states
Date: Mon, 22 Feb 2010 23:19:55 +0100	[thread overview]
Message-ID: <87pr3wlxpw.wl%maus.david@gmail.com> (raw)
In-Reply-To: <87sk8tcfb5.fsf@fastmail.fm>


[-- Attachment #1.1: Type: text/plain, Size: 1772 bytes --]

Matt Lundin wrote:
>Nathaniel Flath <flat0103@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)))
`----

Another solution: use `org-trigger-hook' and `org-schedule':

,----
| (defvar dmj/org-pending-keywords '("PENDING")
|   "List of keywords denoting pending state of an headline.")
| 
| (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
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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	other threads:[~2010-02-22 22:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-20 20:13 Remove scheduled date when switch TODO states Nathaniel Flath
2010-02-21  5:18 ` Manish
2010-02-22 18:10 ` Matt Lundin
2010-02-22 22:19   ` David Maus [this message]
2010-02-22 22:23     ` Matthew Lundin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pr3wlxpw.wl%maus.david@gmail.com \
    --to=maus.david@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).