all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Davis Herring <herring@lanl.gov>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: run-with-timer vs run-with-idle-timer
Date: Wed, 9 May 2018 21:18:02 +0100	[thread overview]
Message-ID: <CALDnm539HjP4-xHZ2hsT+kjoLaUoJWCp2mj_R527khONtp93wg@mail.gmail.com> (raw)
In-Reply-To: <9ca64601-289b-c622-555a-9b5b9b6900aa@lanl.gov>

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

On Wed, May 9, 2018 at 9:00 PM, Davis Herring <herring@lanl.gov> wrote:
>>>
>>> An idle timer set for 600 seconds will run when ten minutes have
>>> elapsed since the last user command was finished, even if subprocess
>>> output has been accepted thousands of times within those ten minutes,
>>> and even if there have been garbage collections and autosaves.
>>
>>
>> Doesn't this contradict what you told me first?  I.e doesn't this
>> contradict the fact that this never returns?
>>
>>    (catch 'done
>>      (run-with-idle-timer 600 nil (lambda () (throw 'done nil)))
>>      (while t (accept-process-output nil 0.1))) ; 6 thousand times
>>
>> or should the manual be saying "even if subprocesses output has been
>> non-explictly accepted thousands of times"?
>
>
> No, because whatever command you used to invoke that code (C-x C-e in the
trivial case) doesn't finish unless and until the loop finishes.  So no
time has yet "elapsed since the last user command was finished", regardless
of anything about subprocesses.

Indeed.

(run-with-timer
 1 nil
 (lambda ()
   (catch 'done
     (run-with-idle-timer 3 nil (lambda () (throw 'done nil)))
     (while t (accept-process-output nil 0.1)))
   (message "ok!")))

Does print "ok". However this blocks typing for 3 seconds. So in a way,
it forces idleness. Gross idea anyway. Wonder what happens in the filter...

João

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

  reply	other threads:[~2018-05-09 20:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 17:34 run-with-timer vs run-with-idle-timer João Távora
2018-05-09 18:10 ` Eli Zaretskii
2018-05-09 18:17 ` Eli Zaretskii
2018-05-09 18:40   ` João Távora
2018-05-09 18:59     ` Eli Zaretskii
2018-05-09 19:15       ` João Távora
2018-05-09 19:21         ` Eli Zaretskii
2018-05-09 19:34           ` João Távora
2018-05-09 20:00         ` Davis Herring
2018-05-09 20:18           ` João Távora [this message]
2018-05-10 11:46 ` Thien-Thi Nguyen
2018-05-10 12:28   ` João Távora
2018-05-10 18:50     ` Thien-Thi Nguyen
2018-05-11 10:39       ` João Távora
2018-05-11 11:05         ` João Távora
2018-05-12 17:57           ` Thien-Thi Nguyen
2018-05-12 17:37         ` Thien-Thi Nguyen

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

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

  git send-email \
    --in-reply-to=CALDnm539HjP4-xHZ2hsT+kjoLaUoJWCp2mj_R527khONtp93wg@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=herring@lanl.gov \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.