[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51094: Check if run-with{-idle, }-timer needs to create a timer
From: |
Basil L. Contovounesios |
Subject: |
bug#51094: Check if run-with{-idle, }-timer needs to create a timer |
Date: |
Fri, 08 Oct 2021 12:29:05 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Philip Kaludercic [2021-10-08 11:03 +0000] wrote:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>> Philip Kaludercic [2021-10-08 09:36 +0000] wrote:
>>
>>> I have seen a few packages use run-with-timer or run-with-idle-timer,
>>> where the SECS parameter is configurable with a user option. When this
>>> timer doesn't repeat itself and it makes sense to set SECS to 0 when you
>>> want something to run immediately, I don't think it makes sense to
>>> create a timer object.
>>
>> IIUC, the semantics of SECS=0 (alias nil) is not the same as eager
>> funcall, because timer functions are intended to be run asynchronously
>> in a separate command loop. So often what is meant by "now" is e.g. "as
>> soon as I quit the current active minibuffer".
>
> I see, it might be necessary to consider examples where this might go
> wrong.
Off the top of my head there's also ivy-quit-and-run in the ivy package,
but Lars pointed to effectively the same idiom.
>> I realise this patch does not touch run-at-time, but it's documented as
>> being interchangeable with run-with-timer, so the eager funcall sounds
>> like a breaking change.
>>
>> If packages indeed want to run something immediately, why create a timer
>> at all? Or am I misunderstanding something?
>
> Because you might want to delay certain things, such as highlighting or
> completion.
What I meant is, the choice whether to run-with-timer or funcall can be
left to the calling package, since it knows better what it wants to do.
Thanks,
--
Basil
- bug#51094: Check if run-with{-idle,}-timer needs to create a timer, Philip Kaludercic, 2021/10/08
- bug#51094: Check if run-with{-idle, }-timer needs to create a timer, Philip Kaludercic, 2021/10/08
- bug#51094: Check if run-with{-idle, }-timer needs to create a timer,
Basil L. Contovounesios <=
- bug#51094: Check if run-with{-idle, }-timer needs to create a timer, Eli Zaretskii, 2021/10/08
bug#51094: Check if run-with{-idle, }-timer needs to create a timer, Eli Zaretskii, 2021/10/08