emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ypo <ypuntot@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: org-todo-state-tags-triggers not working with regexp?
Date: Thu, 29 Jun 2023 17:10:45 +0200	[thread overview]
Message-ID: <b1e16e94-7356-6592-f0ac-bd7b929c7982@gmail.com> (raw)
In-Reply-To: <87o7l1az53.fsf@localhost>

[-- 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 --]

      reply	other threads:[~2023-06-29 15:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

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=b1e16e94-7356-6592-f0ac-bd7b929c7982@gmail.com \
    --to=ypuntot@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).