From: Samuel Loury <konubinix@gmail.com>
To: Samuel Banya <sbanya@fastmail.com>, emacs-orgmode@gnu.org
Subject: Re: Question About Nuking The Priority Of A Task After Its Been Marked As 'DONE'
Date: Sat, 11 Dec 2021 13:49:43 +0100 [thread overview]
Message-ID: <87v8zvs3vc.fsf@gmail.com> (raw)
In-Reply-To: <3c86bbd6-89d7-46b5-9bb5-60ca414b4516@www.fastmail.com>
[-- 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 --]
next prev parent reply other threads:[~2021-12-11 12:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-12-11 17:51 ` Samuel Banya
2021-12-17 18:38 ` Samuel Banya
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=87v8zvs3vc.fsf@gmail.com \
--to=konubinix@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=sbanya@fastmail.com \
/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).