unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* run-with-idle-timer Doc string Question
@ 2020-08-21 17:06 T.V Raman
  2020-08-21 19:06 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: T.V Raman @ 2020-08-21 17:06 UTC (permalink / raw)
  To: emacs-devel

What does this line:
Using
SECS <= N is not recommended if this function is invoked from an idle
timer, because FUNCTION will then be called immediately.

in the doc-string for run-with-idle-timer mean?

run-with-idle-timer is an interactive compiled Lisp function in
‘timer.el’.

(run-with-idle-timer SECS REPEAT FUNCTION &rest ARGS)

  Probably introduced at or before Emacs version 19.31.

Perform an action the next time Emacs is idle for SECS seconds.
The action is to call FUNCTION with arguments ARGS.
SECS may be an integer, a floating point number, or the internal
time format returned by, e.g., ‘current-idle-time’.
If Emacs is currently idle, and has been idle for N seconds (N < SECS),
then it will call FUNCTION in SECS - N seconds from now.  Using
SECS <= N is not recommended if this function is invoked from an idle
timer, because FUNCTION will then be called immediately.

If REPEAT is non-nil, do the action each time Emacs has been idle for
exactly SECS seconds (that is, only once for each time Emacs becomes idle).

This function returns a timer object which you can use in ‘cancel-timer’.

[back]


-- 
♉Id: kg:/m/0285kf1  🦮♉

-- 
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: run-with-idle-timer Doc string Question
  2020-08-21 17:06 run-with-idle-timer Doc string Question T.V Raman
@ 2020-08-21 19:06 ` Eli Zaretskii
  2020-08-21 19:46   ` T.V Raman
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-08-21 19:06 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

> From: "T.V Raman" <raman@google.com>
> Date: Fri, 21 Aug 2020 10:06:39 -0700 (PDT)
> 
> What does this line:
> Using
> SECS <= N is not recommended if this function is invoked from an idle
> timer, because FUNCTION will then be called immediately.
> 
> in the doc-string for run-with-idle-timer mean?

Which part of that sentence is unclear?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: run-with-idle-timer Doc string Question
  2020-08-21 19:06 ` Eli Zaretskii
@ 2020-08-21 19:46   ` T.V Raman
  2020-08-21 19:49     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: T.V Raman @ 2020-08-21 19:46 UTC (permalink / raw)
  To: eliz; +Cc: raman, emacs-devel

The whole sentence I cited. How exactly would one specify sec < n?

Eli Zaretskii writes:
 > > From: "T.V Raman" <raman@google.com>
 > > Date: Fri, 21 Aug 2020 10:06:39 -0700 (PDT)
 > > 
 > > What does this line:
 > > Using
 > > SECS <= N is not recommended if this function is invoked from an idle
 > > timer, because FUNCTION will then be called immediately.
 > > 
 > > in the doc-string for run-with-idle-timer mean?
 > 
 > Which part of that sentence is unclear?

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: run-with-idle-timer Doc string Question
  2020-08-21 19:46   ` T.V Raman
@ 2020-08-21 19:49     ` Eli Zaretskii
  2020-08-21 20:49       ` Narendra Joshi
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-08-21 19:49 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel, raman

> From: "T.V Raman" <raman@google.com>
> Date: Fri, 21 Aug 2020 12:46:48 -0700
> Cc: raman@google.com,
>     emacs-devel@gnu.org
> 
> The whole sentence I cited. How exactly would one specify sec < n?

So you are saying that the sentence is clear, but you don't understand
how such a situation can happen?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: run-with-idle-timer Doc string Question
  2020-08-21 19:49     ` Eli Zaretskii
@ 2020-08-21 20:49       ` Narendra Joshi
  2020-08-21 21:23         ` Drew Adams
  0 siblings, 1 reply; 7+ messages in thread
From: Narendra Joshi @ 2020-08-21 20:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs Devel, T.V Raman

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

I think the part that makes it a bit confusing is that we are talking about
calling run-with-idle-timer with a lower value of SECS from an already
executing callback for another run-with-idle-timer.

On Fri, 21 Aug 2020, 21:49 Eli Zaretskii, <eliz@gnu.org> wrote:

> > From: "T.V Raman" <raman@google.com>
> > Date: Fri, 21 Aug 2020 12:46:48 -0700
> > Cc: raman@google.com,
> >     emacs-devel@gnu.org
> >
> > The whole sentence I cited. How exactly would one specify sec < n?
>
> So you are saying that the sentence is clear, but you don't understand
> how such a situation can happen?
>
>

[-- Attachment #2: Type: text/html, Size: 1138 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: run-with-idle-timer Doc string Question
  2020-08-21 20:49       ` Narendra Joshi
@ 2020-08-21 21:23         ` Drew Adams
  2020-08-22 11:05           ` Narendra Joshi
  0 siblings, 1 reply; 7+ messages in thread
From: Drew Adams @ 2020-08-21 21:23 UTC (permalink / raw)
  To: Narendra Joshi, Eli Zaretskii; +Cc: T.V Raman, Emacs Devel

> I think the part that makes it a bit confusing is
> that we are talking about calling run-with-idle-timer
> with a lower value of SECS from an already executing
> callback for another run-with-idle-timer.

Gee, what could possibly be confusing about that? ;-)

(Especially if we don't say that explicitly.)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: run-with-idle-timer Doc string Question
  2020-08-21 21:23         ` Drew Adams
@ 2020-08-22 11:05           ` Narendra Joshi
  0 siblings, 0 replies; 7+ messages in thread
From: Narendra Joshi @ 2020-08-22 11:05 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, T.V Raman, Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 674 bytes --]

It took me a long time to arrive at the fact that it is only possible to
know that Emacs has already been idle for SECS seconds when we are
executing a callback for a run-with-idle-timer call with a delay arg of
SECS seconds. The docstring could state this in more detail.

On Fri, 21 Aug 2020, 23:25 Drew Adams, <drew.adams@oracle.com> wrote:

> > I think the part that makes it a bit confusing is
> > that we are talking about calling run-with-idle-timer
> > with a lower value of SECS from an already executing
> > callback for another run-with-idle-timer.
>
> Gee, what could possibly be confusing about that? ;-)
>
> (Especially if we don't say that explicitly.)
>
>
>

[-- Attachment #2: Type: text/html, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-22 11:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-21 17:06 run-with-idle-timer Doc string Question T.V Raman
2020-08-21 19:06 ` Eli Zaretskii
2020-08-21 19:46   ` T.V Raman
2020-08-21 19:49     ` Eli Zaretskii
2020-08-21 20:49       ` Narendra Joshi
2020-08-21 21:23         ` Drew Adams
2020-08-22 11:05           ` Narendra Joshi

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