unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 51094@debbugs.gnu.org
Subject: bug#51094: Check if run-with{-idle, }-timer needs to create a timer
Date: Fri, 08 Oct 2021 11:03:18 +0000	[thread overview]
Message-ID: <87k0in7p8p.fsf@posteo.net> (raw)
In-Reply-To: <87a6jjn6af.fsf@tcd.ie> (Basil L. Contovounesios's message of "Fri, 08 Oct 2021 11:46:00 +0100")

"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.

> 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. It makes sense on older devices, but modern systems can run
a lot of things immediately. Consider lazy-highlight-initial-delay or
the icomplete options. On my desktop I have no issue with setting
lazy-highlight-initial-delay to 0 but on my laptop I keep the default
value.

> Thanks,

-- 
	Philip Kaludercic





  parent reply	other threads:[~2021-10-08 11:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08  9:36 bug#51094: Check if run-with{-idle,}-timer needs to create a timer Philip Kaludercic
2021-10-08 10:46 ` bug#51094: Check if run-with{-idle, }-timer " Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-08 10:53   ` Lars Ingebrigtsen
2021-10-08 11:14     ` Lars Ingebrigtsen
2021-10-08 11:33       ` Philip Kaludercic
2021-10-08 12:29         ` Lars Ingebrigtsen
2021-10-08 11:03   ` Philip Kaludercic [this message]
2021-10-08 11:29     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-08 11:13   ` Eli Zaretskii
2021-10-08 11:08 ` Eli Zaretskii

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0in7p8p.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=51094@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    /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.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).