* Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE'
@ 2021-12-10 18:55 Samuel Banya
2021-12-10 22:51 ` Peter Hardy
2021-12-11 12:49 ` Samuel Loury
0 siblings, 2 replies; 5+ messages in thread
From: Samuel Banya @ 2021-12-10 18:55 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 315 bytes --]
Hey there,
I often change states of my todo list items to 'DONE', 'CANCELLED', etc.
However, one thing I would want to know is this:
- Is it possible to automatically delete the '#' priority value of a task after a task has been marked as 'DONE', 'CANCELLED', etc?
Is this done via a hook function?
Thanks,
Sam
[-- Attachment #2: Type: text/html, Size: 609 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE'
2021-12-10 18:55 Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE' Samuel Banya
@ 2021-12-10 22:51 ` Peter Hardy
2021-12-11 12:49 ` Samuel Loury
1 sibling, 0 replies; 5+ messages in thread
From: Peter Hardy @ 2021-12-10 22:51 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
On Sat, 11 Dec 2021, at 5:55 AM, Samuel Banya wrote:
> However, one thing I would want to know is this:
> - Is it possible to automatically delete the '#' priority value of a task after a task has been marked as 'DONE', 'CANCELLED', etc?
>
> Is this done via a hook function?
Probably!
The org documentation (https://orgmode.org/worg/doc.html) includes a list of all of the hooks it supports. If you search it you'll find `org-after-todo-state-change-hook`, which seems to be exactly what you need. Keep digging, and you'll find the `org-priority` function to set an item's priority.
Looks like all you'd need to do is write a hook function to check the new state, and then change the priority.
--
Peter
[-- Attachment #2: Type: text/html, Size: 1157 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE'
2021-12-10 18:55 Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE' Samuel Banya
2021-12-10 22:51 ` Peter Hardy
@ 2021-12-11 12:49 ` Samuel Loury
2021-12-11 17:51 ` Samuel Banya
1 sibling, 1 reply; 5+ messages in thread
From: Samuel Loury @ 2021-12-11 12:49 UTC (permalink / raw)
To: Samuel Banya, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]
"Samuel Banya" <sbanya@fastmail.com> writes:
> I often change states of my todo list items to 'DONE', 'CANCELLED', etc.
>
> However, one thing I would want to know is this:
> - Is it possible to automatically delete the '#' priority value of a task after a task has been marked as 'DONE', 'CANCELLED', etc?
>
> Is this done via a hook function?
To do it globally:
--8<---------------cut here---------------start------------->8---
(defun my/org-trigger-hook (change-plist)
(let* ((type (plist-get change-plist :type))
(pos (plist-get change-plist :position))
(from (substring-no-properties (or (plist-get change-plist :from) "")))
(to (substring-no-properties (or (plist-get change-plist :to) "")))
)
(when (and
(eq type 'todo-state-change)
(member to org-done-keywords)
(member from org-not-done-keywords)
)
(org-priority (string-to-char " "))
)
)
)
(add-hook #'org-trigger-hook
#'my/org-trigger-hook)
--8<---------------cut here---------------end--------------->8---
But if, like me, you want to define this behavior per task, this is one
of the purposes of org-edna. I suggest you try it.
I your particular example, you would simply set the TRIGGER property of
the task for which you want to delete the priority to this content
--8<---------------cut here---------------start------------->8---
* NEXT [#B] some task
:PROPERTIES:
:TRIGGER: self() set-priority!(" ")
:END:
--8<---------------cut here---------------end--------------->8---
Closing it would result in
--8<---------------cut here---------------start------------->8---
* DONE some task
CLOSED: [2021-12-11 Sat 13:38]
:PROPERTIES:
:TRIGGER: self() set-priority!(" ")
:END:
--8<---------------cut here---------------end--------------->8---
Of course, it also work for repeated task or any complicated scenario
I have tried so far.
I hope that helps,
--
Konubinix
GPG Key : 7439106A
Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE'
2021-12-11 12:49 ` Samuel Loury
@ 2021-12-11 17:51 ` Samuel Banya
2021-12-17 18:38 ` Samuel Banya
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Banya @ 2021-12-11 17:51 UTC (permalink / raw)
To: Samuel Loury, Charles Berry
[-- Attachment #1: Type: text/plain, Size: 2464 bytes --]
Hey Konibunix!
Thanks a ton for this, this looks fun as heck to implement :)
I'll have to try this on my config sometime next week. Thanks a ton for this, bookmarking this post for now.
Love it :)
On Sat, Dec 11, 2021, at 7:49 AM, Samuel Loury wrote:
> "Samuel Banya" <sbanya@fastmail.com> writes:
>
> > I often change states of my todo list items to 'DONE', 'CANCELLED', etc.
> >
> > However, one thing I would want to know is this:
> > - Is it possible to automatically delete the '#' priority value of a task after a task has been marked as 'DONE', 'CANCELLED', etc?
> >
> > Is this done via a hook function?
>
> To do it globally:
>
> --8<---------------cut here---------------start------------->8---
> (defun my/org-trigger-hook (change-plist)
> (let* ((type (plist-get change-plist :type))
> (pos (plist-get change-plist :position))
> (from (substring-no-properties (or (plist-get change-plist :from) "")))
> (to (substring-no-properties (or (plist-get change-plist :to) "")))
> )
> (when (and
> (eq type 'todo-state-change)
> (member to org-done-keywords)
> (member from org-not-done-keywords)
> )
> (org-priority (string-to-char " "))
> )
> )
> )
>
> (add-hook #'org-trigger-hook
> #'my/org-trigger-hook)
> --8<---------------cut here---------------end--------------->8---
>
>
> But if, like me, you want to define this behavior per task, this is one
> of the purposes of org-edna. I suggest you try it.
>
> I your particular example, you would simply set the TRIGGER property of
> the task for which you want to delete the priority to this content
>
> --8<---------------cut here---------------start------------->8---
> * NEXT [#B] some task
> :PROPERTIES:
> :TRIGGER: self() set-priority!(" ")
> :END:
> --8<---------------cut here---------------end--------------->8---
>
> Closing it would result in
>
> --8<---------------cut here---------------start------------->8---
> * DONE some task
> CLOSED: [2021-12-11 Sat 13:38]
> :PROPERTIES:
> :TRIGGER: self() set-priority!(" ")
> :END:
> --8<---------------cut here---------------end--------------->8---
>
> Of course, it also work for repeated task or any complicated scenario
> I have tried so far.
>
> I hope that helps,
> --
> Konubinix
> GPG Key : 7439106A
> Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
>
>
> *Attachments:*
> * signature.asc
[-- Attachment #2: Type: text/html, Size: 4246 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE'
2021-12-11 17:51 ` Samuel Banya
@ 2021-12-17 18:38 ` Samuel Banya
0 siblings, 0 replies; 5+ messages in thread
From: Samuel Banya @ 2021-12-17 18:38 UTC (permalink / raw)
To: Charles Berry
[-- Attachment #1: Type: text/plain, Size: 2919 bytes --]
Rather, thanks Samuel Loury! :)
Good to know great Sam's exist that like Emacs out there ;)
I tried it today, and this totally worked in my config.
Thanks a ton for this, very cool function, and SUPER useful for me as I mark stuff as 'DONE' a ton within my workflow for tickets at work.
Thanks again!
Sam
On Sat, Dec 11, 2021, at 12:51 PM, Samuel Banya wrote:
> Hey Konibunix!
>
> Thanks a ton for this, this looks fun as heck to implement :)
>
> I'll have to try this on my config sometime next week. Thanks a ton for this, bookmarking this post for now.
>
> Love it :)
>
> On Sat, Dec 11, 2021, at 7:49 AM, Samuel Loury wrote:
>> "Samuel Banya" <sbanya@fastmail.com> writes:
>>
>> > I often change states of my todo list items to 'DONE', 'CANCELLED', etc.
>> >
>> > However, one thing I would want to know is this:
>> > - Is it possible to automatically delete the '#' priority value of a task after a task has been marked as 'DONE', 'CANCELLED', etc?
>> >
>> > Is this done via a hook function?
>>
>> To do it globally:
>>
>> --8<---------------cut here---------------start------------->8---
>> (defun my/org-trigger-hook (change-plist)
>> (let* ((type (plist-get change-plist :type))
>> (pos (plist-get change-plist :position))
>> (from (substring-no-properties (or (plist-get change-plist :from) "")))
>> (to (substring-no-properties (or (plist-get change-plist :to) "")))
>> )
>> (when (and
>> (eq type 'todo-state-change)
>> (member to org-done-keywords)
>> (member from org-not-done-keywords)
>> )
>> (org-priority (string-to-char " "))
>> )
>> )
>> )
>>
>> (add-hook #'org-trigger-hook
>> #'my/org-trigger-hook)
>> --8<---------------cut here---------------end--------------->8---
>>
>>
>> But if, like me, you want to define this behavior per task, this is one
>> of the purposes of org-edna. I suggest you try it.
>>
>> I your particular example, you would simply set the TRIGGER property of
>> the task for which you want to delete the priority to this content
>>
>> --8<---------------cut here---------------start------------->8---
>> * NEXT [#B] some task
>> :PROPERTIES:
>> :TRIGGER: self() set-priority!(" ")
>> :END:
>> --8<---------------cut here---------------end--------------->8---
>>
>> Closing it would result in
>>
>> --8<---------------cut here---------------start------------->8---
>> * DONE some task
>> CLOSED: [2021-12-11 Sat 13:38]
>> :PROPERTIES:
>> :TRIGGER: self() set-priority!(" ")
>> :END:
>> --8<---------------cut here---------------end--------------->8---
>>
>> Of course, it also work for repeated task or any complicated scenario
>> I have tried so far.
>>
>> I hope that helps,
>> --
>> Konubinix
>> GPG Key : 7439106A
>> Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
>>
>>
>> *Attachments:*
>> * signature.asc
>
[-- Attachment #2: Type: text/html, Size: 4853 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-17 18:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-10 18:55 Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE' Samuel Banya
2021-12-10 22:51 ` Peter Hardy
2021-12-11 12:49 ` Samuel Loury
2021-12-11 17:51 ` Samuel Banya
2021-12-17 18:38 ` Samuel Banya
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).