From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id EMJSMMV4g2fkvgAAe85BDQ:P1 (envelope-from ) for ; Sun, 12 Jan 2025 08:09:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id EMJSMMV4g2fkvgAAe85BDQ (envelope-from ) for ; Sun, 12 Jan 2025 09:09:41 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="KFs53/Ri"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736669381; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GuiOLY67eYScvZ4h4ysiLyu1ncsp1CHleEj9bWx46zQ=; b=WwS8r5eLysjUvWQWmQtd5ar/qFVjPaKQwQKx28slfI0+rvveuo5wwfc7Gan4YJpSo+7+aE 6ztBoQ7lxTpjkddaJyJz5HIjTeVcQ1CaNnQKUpuyDUszlz8A/oWKmMWzGHzk/Irzf4xc4N Ryq6bzCqtf3jTw97dv9a+1j9st9wuazBMZF4oabSuSC0x022UDVRjEdbxlavNcuN4RJAyc mJDTwoW4Pm9biveUkVibKVWPcomltj6KCm31o+nknwGBw98PSRQE6xweRUTIFLJGDWrwjC EtsPoi3QIvJPwPMakpwi//d+JqLqlHxzvlfCLsp9qF66C9Gr1POgLc+yZB0rpg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="KFs53/Ri"; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736669381; a=rsa-sha256; cv=none; b=WwURTjzUPP4WYa5BVa/5VRorqLbfp0626Q7DnUxTHY5aDF8OkDDcmCAJnOUchJ1s+x7THT IxMdZDhhTwBDZgIBGWSNtVA4HWXgXNJablpqxApqGrNSlPiK0da8tyc7GrIMq+aBarVCeG WYR1B0Tas1g6sIzk1ZNx7Wga0YPeZuwEBZJXhYjjtV4VyKlD2bofNs64O16iqTP/SEv3L9 sGbmvRe+7J+GDjkUWIMdXCKB/3z28YtAZAb9msf2vV/iuCLCZAWLP05dhJXjZmySuHfckr TXab0LpNPXorJGR4Iu8eA+L4Wh5l5ay1DrUrHpWaaVNbwmqDtjkks7HnA5OsSg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 930F894E62 for ; Sun, 12 Jan 2025 09:09:41 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tWt2N-0002rI-3Y; Sun, 12 Jan 2025 03:09:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tWt2L-0002qv-Sz for emacs-orgmode@gnu.org; Sun, 12 Jan 2025 03:09:33 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tWt2K-00073p-4Q for emacs-orgmode@gnu.org; Sun, 12 Jan 2025 03:09:33 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7A9D9240101 for ; Sun, 12 Jan 2025 09:09:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1736669369; bh=MFQj+RnfQ//aoPLeZzK+II5E1xMXqwPnKgxh65HkWgI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=KFs53/RiVV2DyKb32lush/4de21vLv32UtzPayjdmZ0bLn79ESUfl9gxS0q0EXqGe vzyTXdp5X3MAjuYNSBA/xzgU6vGI3Y5/hqY3w2BpYUr4RfU1QnYR/jpnFBRSzzRVJe L1iyMj5abxE2FfRoSfM847jv/P+iViPXysiIj8NjEyoN7RmRBi0kBIPx5rfocs57q5 bLtaVNJCawiCY2zZakBUf/gjjh8ArTIH8KnzITr7Rw8+IQIHV23IGNlorYhblqeDfG 1VUGqOYM4cjx+UDYmdl8f7gRetKNKb1GENOPdFbtxrr/485639zxMbUu0JIh9lA8zW k9dUQ5gj58HLw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YW7Mr6fxbz6trs; Sun, 12 Jan 2025 09:09:28 +0100 (CET) From: Ihor Radchenko To: Stefan van der Walt Cc: emacs-orgmode@gnu.org Subject: Re: org-timer: let done hook access time, allow silencing notification In-Reply-To: <52611558-9247-44c2-a51c-5f0dd8662fe1@app.fastmail.com> References: <87a5bxz2w0.fsf@localhost> <52611558-9247-44c2-a51c-5f0dd8662fe1@app.fastmail.com> Date: Sun, 12 Jan 2025 08:11:48 +0000 Message-ID: <874j2478or.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -8.01 X-Spam-Score: -8.01 X-Migadu-Queue-Id: 930F894E62 X-Migadu-Scanner: mx10.migadu.com X-TUID: PCwbseDryqo5 "Stefan van der Walt" writes: >>> Could we reset the variable *after* the hooks are run instead, so that they can access the timer value? >> >> Yes, that would make sense. See the attached tentative patch. > > Thanks, Ihor! That patch looks great. In the description: `ran` -> `run`. Applied, onto main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9368db471b >>> 2. I have a custom notification for when the timer is done, installed via the done hook. I would like to suppress the existing notification, but there seems to be no option to do so. Would it make sense to provide a mechanism to override/silence the notification? >> >> We can do it. >> One would need to implement analogues to >> org-timer-start/stop/pause/continue/set/done-hook that will hold what >> Org does by default at that point (turn on/off mode line, play sound, >> print message, etc). Something like >> org-timer-start/stop/...-default-hook. > > That would be a good generic solution. In my case, if I can suppress org-show-notification, it'd be enough. Here's what I tried (but it didn't work): > > (defun stefanv/suppress-org-notify (orig-fun &rest args) > (cl-letf ( > ((symbol-function 'org-show-notification) (lambda (&rest _) (ignore))) > ) > (apply orig-fun args))) > (advice-add 'org-timer--run-countdown-timer :around #'stefanv/suppress-org-notify) Your solution won't work because `org-timer--run-countdown-timer' does not actually execute `org-show-notification'. It just sets up a timer to call that function later, outside the dynamic scope you are setting up with `cl-letf'. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at . Support Org development at , or support my work at