unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Phil Sainty" <psainty@orcon.net.nz>
To: "Stefan Monnier" <monnier@IRO.UMontreal.CA>
Cc: 14820@debbugs.gnu.org
Subject: bug#14820: 24.3; elisp manual: How to write good idle timer worker functions?
Date: Thu, 11 Jul 2013 03:31:25 +1200 (NZST)	[thread overview]
Message-ID: <50216.121.99.89.166.1373470285.squirrel@mail.orcon.net.nz> (raw)
In-Reply-To: <jwvsizmke68.fsf-monnier+emacs@gnu.org>

Stefan Monnier wrote:
> Currently, Emacs doesn't support such "background tasks" well.
> Documentation could help, but I think it's not really worth the
> trouble.  Better come up with a package that provides support
> for it.

Well surely you'd agree that writing such a package is going to be
more much difficult without documentation? That is essentially the
problem I ran into here, after all.

At the absolute minimum, that page definitely needs to mention
`sit-for' / "(elisp) Waiting" and `accept-process-output' /
"(elisp) Accepting Output". After all, when specific pit-falls
are mentioned, I think that the available facilities for working
around them warrant at least a passing mention.

(Honestly, the merest mention of these two functions after the
description of the problems of blocking other timers and processes
would have saved me many hours, so it's worth it just for the
potential to save someone else from being similarly stumped. I'd
simply never had cause to use them before, so it wasn't *at all*
obvious where to look.)

Having found my way to the latter, and run some experiments with
generating output from a shell while running my idle timer code,
I've managed to answer my own question about `sit-for' (which is
that it does not solve the problem of accepting process output), but
determined that (unsurprisingly) calling `(accept-process-output)'
does provide a solution, so I believe I'm on my way to resolving my
original issue.

I do still think that if there were some nice easy-to-use wrappers
around the functionality that Emacs *does* provide, we could say
something a little more positive about the situation -- that
*despite* not supporting "background tasks" well, Emacs makes
it easy to fake them!


> IIRC someone posted some packages that try to provide support
> for related issues, but I can't find the corresponding email.

Ah, that's a shame; but thank you for looking. Maybe someone
else remembers what those were?

Failing that, if I end up with something that seems useful and
generic, I'll submit it for consideration.


-Phil

p.s. Although I *think* I now know what I'm doing here, I don't
want to close this issue just yet. I'm very interested in any and
all comments on this subject, if any other people wish to chip in
with their thoughts?







  reply	other threads:[~2013-07-10 15:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-08 13:25 bug#14820: 24.3; elisp manual: How to write good idle timer worker functions? Phil Sainty
2013-07-10  8:35 ` Stefan Monnier
2013-07-10 15:31   ` Phil Sainty [this message]
2013-07-11 13:39     ` Daimrod
2013-07-13  6:38       ` Phil Sainty
2013-07-11 22:52     ` Stefan Monnier
2022-01-26 17:41 ` Lars Ingebrigtsen
2022-02-23 20:15   ` Lars Ingebrigtsen

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=50216.121.99.89.166.1373470285.squirrel@mail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=14820@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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).