help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why doesn't emacs yield more?


From: Eli Zaretskii
Subject: Re: Why doesn't emacs yield more?
Date: Thu, 29 Aug 2019 15:30:12 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]