From: "Stefan van der Walt" <stefanv@berkeley.edu>
To: "Ihor Radchenko" <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-timer: let done hook access time, allow silencing notification
Date: Sat, 11 Jan 2025 21:56:06 -0800 [thread overview]
Message-ID: <52611558-9247-44c2-a51c-5f0dd8662fe1@app.fastmail.com> (raw)
In-Reply-To: <87a5bxz2w0.fsf@localhost>
On Sat, Jan 11, 2025, at 09:17, Ihor Radchenko wrote:
> "Stefan van der Walt" <stefanv@berkeley.edu> writes:
>
>> I have two small improvement suggestions for org-timer, and would like to hear your thoughts.
>>
>> 1. I use org-timer to run pomodoro-style clocks. When the timer finishes, I would like to generate a log entry. It would be helpful to be able to access the duration of the clock; however, in org-timer--run-countdown-timer, the variable org-timer-start-time is reset BEFORE the org-timer-done-hook is run.
>>
>> 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`.
>> 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)
Stéfan
next prev parent reply other threads:[~2025-01-12 5:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 20:09 org-timer: let done hook access time, allow silencing notification Stefan van der Walt
2025-01-11 17:17 ` Ihor Radchenko
2025-01-12 5:56 ` Stefan van der Walt [this message]
2025-01-12 8:11 ` Ihor Radchenko
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=52611558-9247-44c2-a51c-5f0dd8662fe1@app.fastmail.com \
--to=stefanv@berkeley.edu \
--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).