all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Why doesn't emacs yield more?
@ 2019-08-29  9:33 ndame
  2019-08-29 12:30 ` Eli Zaretskii
  2019-08-29 13:00 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: ndame @ 2019-08-29  9:33 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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.

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?

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?


(I posted this to help, because I don't know the internal architecture
of emacs, so the question may be naive or unworkable.)


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Why doesn't emacs yield more?
@ 2019-08-29 15:39 ndame
  2019-08-29 18:46 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: ndame @ 2019-08-29 15:39 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

> 
> 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.

If I e.g. do a C-y and consquently emacs starts a long operation then
if I interrupt then emacs could simply restore the buffer/display state
from before the C-y state. I didn't see my C-y operation finish
because of the redisplay, so I wouldn't mind if a C-g would cancel that
too.

I don't know if a snapshot can be made of the current buffer/display
state, but if emacs can do that then it could simply restore the
previous snapshot instantly, so there would be no issue of inconsistent
buffer/display after interrupting.


> 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.

Interesting. I'll try it next time.

> > 
> > 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.

Thanks. I didn't know that.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-29 18:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-29  9:33 Why doesn't emacs yield more? ndame
2019-08-29 12:30 ` Eli Zaretskii
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

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.