* org-todo-state-tags-triggers not working with regexp?
@ 2023-06-11 11:21 Ypo
2023-06-11 11:41 ` Ihor Radchenko
0 siblings, 1 reply; 5+ messages in thread
From: Ypo @ 2023-06-11 11:21 UTC (permalink / raw)
To: Org-mode
[-- Attachment #1: Type: text/plain, Size: 233 bytes --]
Hi
I would like to remove every tag when changing to done state.
This is not working:
'(org-todo-state-tags-triggers '((done ("(.*)"))))
This works though:
'(org-todo-state-tags-triggers '((done ("Atag"))))
Best regards
[-- Attachment #2: Type: text/html, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-todo-state-tags-triggers not working with regexp?
2023-06-11 11:21 org-todo-state-tags-triggers not working with regexp? Ypo
@ 2023-06-11 11:41 ` Ihor Radchenko
2023-06-27 11:39 ` Ypo
0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-06-11 11:41 UTC (permalink / raw)
To: Ypo; +Cc: Org-mode
Ypo <ypuntot@gmail.com> writes:
> I would like to remove every tag when changing to done state.
>
> This is not working:
>
> '(org-todo-state-tags-triggers '((done ("(.*)"))))
>
> This works though:
>
> '(org-todo-state-tags-triggers '((done ("Atag"))))
Yes, regexps are not supported in `org-todo-state-tags-triggers'.
You can use `org-trigger-hook'.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-todo-state-tags-triggers not working with regexp?
2023-06-11 11:41 ` Ihor Radchenko
@ 2023-06-27 11:39 ` Ypo
2023-06-27 12:05 ` Ihor Radchenko
0 siblings, 1 reply; 5+ messages in thread
From: Ypo @ 2023-06-27 11:39 UTC (permalink / raw)
Cc: Org-mode
[-- Attachment #1: Type: text/plain, Size: 842 bytes --]
Hi, Ihor.
I have tried gptel inside emacs (I'm sorry, but I need to tell it) and I
got this code:
#+begin_src emacs-lisp
(defun my-org-trigger-function (state)
"Remove all tags when state changes to 'DONE'"
(when (string= state "DONE")
(org-toggle-tag nil 'remove)))
(add-hook 'org-trigger-hook 'my-org-trigger-function)
#+end_src
Surprisingly 8-) it doesn't work. Any help?
Best regards
El 11/06/2023 a las 13:41, Ihor Radchenko escribió:
> Ypo<ypuntot@gmail.com> writes:
>
>> I would like to remove every tag when changing to done state.
>>
>> This is not working:
>>
>> '(org-todo-state-tags-triggers '((done ("(.*)"))))
>>
>> This works though:
>>
>> '(org-todo-state-tags-triggers '((done ("Atag"))))
> Yes, regexps are not supported in `org-todo-state-tags-triggers'.
> You can use `org-trigger-hook'.
>
[-- Attachment #2: Type: text/html, Size: 1708 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-todo-state-tags-triggers not working with regexp?
2023-06-27 11:39 ` Ypo
@ 2023-06-27 12:05 ` Ihor Radchenko
2023-06-29 15:10 ` Ypo
0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-06-27 12:05 UTC (permalink / raw)
To: Ypo; +Cc: Org-mode
Ypo <ypuntot@gmail.com> writes:
> I have tried gptel inside emacs (I'm sorry, but I need to tell it) and I
> got this code:
>
> #+begin_src emacs-lisp
> (defun my-org-trigger-function (state)
> "Remove all tags when state changes to 'DONE'"
> (when (string= state "DONE")
> ...
> (add-hook 'org-trigger-hook 'my-org-trigger-function)
> #+end_src
>
> Surprisingly 8-) it doesn't work. Any help?
org-trigger-hook is a variable defined in org.el.
Documentation
Hook for functions that are triggered by a state change.
Each function gets as its single argument a property list with at
least the following elements:
(:type type-of-change :position pos-at-entry-start
:from old-state :to new-state)
Depending on the type, more properties may be present.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: org-todo-state-tags-triggers not working with regexp?
2023-06-27 12:05 ` Ihor Radchenko
@ 2023-06-29 15:10 ` Ypo
0 siblings, 0 replies; 5+ messages in thread
From: Ypo @ 2023-06-29 15:10 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Org-mode
[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]
Solved, thanks! :-)
;;;_ borrar todas las etiquetas al cambiar el estado a HECHO
(defun borrar-etiquetas-tareas-hechas (plist)
"Borra todas las etiquetas al cambiar una tarea a =HECHO=."
(when (eq (plist-get plist :type) 'todo-state-change)
(when (string= (plist-get plist :to) "HECHO")
(org-set-tags-to nil))))
(add-hook 'org-trigger-hook 'borrar-etiquetas-tareas-hechas)
El 27/06/2023 a las 14:05, Ihor Radchenko escribió:
> Ypo<ypuntot@gmail.com> writes:
>
>> I have tried gptel inside emacs (I'm sorry, but I need to tell it) and I
>> got this code:
>>
>> #+begin_src emacs-lisp
>> (defun my-org-trigger-function (state)
>> "Remove all tags when state changes to 'DONE'"
>> (when (string= state "DONE")
>> ...
>> (add-hook 'org-trigger-hook 'my-org-trigger-function)
>> #+end_src
>>
>> Surprisingly 8-) it doesn't work. Any help?
> org-trigger-hook is a variable defined in org.el.
>
> Documentation
> Hook for functions that are triggered by a state change.
>
> Each function gets as its single argument a property list with at
> least the following elements:
>
> (:type type-of-change :position pos-at-entry-start
> :from old-state :to new-state)
>
> Depending on the type, more properties may be present.
>
[-- Attachment #2: Type: text/html, Size: 2002 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-06-29 15:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-11 11:21 org-todo-state-tags-triggers not working with regexp? Ypo
2023-06-11 11:41 ` Ihor Radchenko
2023-06-27 11:39 ` Ypo
2023-06-27 12:05 ` Ihor Radchenko
2023-06-29 15:10 ` Ypo
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).