* Remove scheduled date when switch TODO states
@ 2010-02-20 20:13 Nathaniel Flath
2010-02-21 5:18 ` Manish
2010-02-22 18:10 ` Matt Lundin
0 siblings, 2 replies; 5+ messages in thread
From: Nathaniel Flath @ 2010-02-20 20:13 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 260 bytes --]
Hello,
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?
Thanks,
Nathaniel Flath
[-- Attachment #1.2: Type: text/html, Size: 282 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Remove scheduled date when switch TODO states
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
1 sibling, 0 replies; 5+ messages in thread
From: Manish @ 2010-02-21 5:18 UTC (permalink / raw)
To: Nathaniel Flath; +Cc: emacs-orgmode
On Sun, Feb 21, 2010 at 1:43 AM, Nathaniel Flath wrote:
> Hello,
>
> 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?
i'm not aware of any in-built way of doing this but org-schedule can be
called with org-trigger-hook to do the job but i still don't know
sufficient elisp to help with an implementation. :(
http://orgmode.org/worg/org-configs/org-hooks.php#sec-1.15
--
manish
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Remove scheduled date when switch TODO states
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
1 sibling, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2010-02-22 18:10 UTC (permalink / raw)
To: Nathaniel Flath; +Cc: emacs-orgmode
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---
Best,
Matt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: Remove scheduled date when switch TODO states
2010-02-22 18:10 ` Matt Lundin
@ 2010-02-22 22:19 ` David Maus
2010-02-22 22:23 ` Matthew Lundin
0 siblings, 1 reply; 5+ messages in thread
From: David Maus @ 2010-02-22 22:19 UTC (permalink / raw)
To: Matt Lundin; +Cc: emacs-orgmode
[-- 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: Remove scheduled date when switch TODO states
2010-02-22 22:19 ` David Maus
@ 2010-02-22 22:23 ` Matthew Lundin
0 siblings, 0 replies; 5+ messages in thread
From: Matthew Lundin @ 2010-02-22 22:23 UTC (permalink / raw)
To: David Maus; +Cc: Matt Lundin, emacs-orgmode
David Maus <maus.david@gmail.com> writes:
> 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)))
> `----
Good to know. Thanks!
- Matt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-22 22:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-02-22 22:23 ` Matthew Lundin
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).