emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-timer: let done hook access time, allow silencing notification


From: Stefan van der Walt
Subject: Re: org-timer: let done hook access time, allow silencing notification
Date: Sat, 11 Jan 2025 21:56:06 -0800

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]