unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Why doesn't emacs yield more?
Date: Thu, 29 Aug 2019 15:30:12 +0300	[thread overview]
Message-ID: <83h860b1d7.fsf@gnu.org> (raw)
In-Reply-To: <Ax0Nuw.uap8MuEzZ3c3.cJMezZcwM7lWkalMjmH9@freemail.hu> (message from ndame on Thu, 29 Aug 2019 11:33:42 +0200 (CEST))

> From: ndame <emacsuser@freemail.hu>
> Date: Thu, 29 Aug 2019 11:33:42 +0200 (CEST)
> 
> I inadvertently pasted a huge elisp list structure into a buffer
> and it took me 10 seconds or so to regain control, because emacs
> was bogged down by formatting/highlighting the list I think.

I'm guessing most of the time was taken by redisplay.  Unless by
"pasting" you mean something other than just C-y.  I'd suggest to tell
more details about the Lisp list structure in question and what you
did to paste it.  Otherwise, this discussion runs a risk of lacking a
solid basis, and could easily be talking about things irrelevant to
your use case.

> It tried to hit C-g several times to no avail which made me
> think: why doesn't emacs yield more during long operations by
> checking if the user canceled the operation?

Emacs does check for C-g during prolonged operations, but only when it
runs Lisp code.  I don't think that's what took most of the time in
your case.

Assuming it was redisplay that took most of the time: you cannot
interrupt it, not by default.  What would be the purpose of that?
Emacs cannot allow the display to be left in a state that is
inconsistent with the contents of the buffer, so it will immediately
reenter another redisplay cycle.

What you can do is type M-< to go to the beginning of the buffer.  If
the problematic portion of the buffer will then be off-screen, you
should be able to stop waiting.

You could also set redisplay-dont-pause non-nil, but IME it helps only
in a small fraction of use cases, and otherwise its effect is for the
worse.

> I don't mean putting checks everywhere manually, but using some
> automatic code translator which would inject such checks
> automatically in the source codes of loops or something, before
> the actual compilation of emacs.
> 
> Would it be a big performance hit? I don't know if the check
> could be inlined somehow. Was something like this discussed
> before?

We already do all that when running Lisp code.



  reply	other threads:[~2019-08-29 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29  9:33 Why doesn't emacs yield more? ndame
2019-08-29 12:30 ` Eli Zaretskii [this message]
2019-08-29 13:00 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2019-08-29 15:39 ndame
2019-08-29 18:46 ` 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=83h860b1d7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).