unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alexander Shukaev <emacs@Alexander.Shukaev.name>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Temporarily disable `timer-event-handler'
Date: Tue, 04 Feb 2020 19:53:31 -0500	[thread overview]
Message-ID: <jwvmu9x516i.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <feaf06a0-8eb1-18c0-ed74-dcd8030866d6@Alexander.Shukaev.name> (Alexander Shukaev's message of "Tue, 4 Feb 2020 23:30:45 +0100")

>> But there can also be cases where A does want/need B to be processed
>> before A ends.
>
> Nonetheless, given the availability of dynamic binding, I find this
> error-prone.  Is there currently a way in Emacs Lisp to run a function 
> within a separate stack,

Yes and no.  Until "recently" the answer was clearly no, and now it's
kinda possible but not in a really nice way:
- using threads (which are not always available, so it can only be used conditionally).
- using `backtrace-eval` which will temporarily undo part of the
  currently installed dynamic bindings (as well as
  `with-current-buffer`s and `save-excursion`s, IIRC) before evaluating
  an expression.

> Additionally, I believe the solution to fulfill
>> The expectation is that `B' strictly runs after `A' finishes execution.
> is also missing.

Yup!

> Some sort of macro (aka `ignore-timers') which essentially
> forbids yielding during the execution of the enclosed body,

No, remember: Emacs is a Lisp machine, aka a kind of OS, so this would
mean that application A hogs the whole machine just because it wants to
prevent B from running.

Instead we need something more specific which lets A delay B without
delaying other, unrelated, events.


        Stefan




  reply	other threads:[~2020-02-05  0:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-02 23:25 Temporarily disable `timer-event-handler' Alexander Shukaev
2020-02-03  1:36 ` Drew Adams
2020-02-03  8:23 ` Michael Albinus
2020-02-03 14:01 ` Stefan Monnier
2020-02-03 15:44   ` Eli Zaretskii
2020-02-04 22:30     ` Alexander Shukaev
2020-02-05  0:53       ` Stefan Monnier [this message]
2020-02-05  1:21         ` Alexander Shukaev
2020-02-05  1:30           ` Stefan Monnier
2020-02-05 14:29           ` Eli Zaretskii
2020-02-05 15:09             ` Michael Albinus

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=jwvmu9x516i.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs@Alexander.Shukaev.name \
    /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).