unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 45898@debbugs.gnu.org
Subject: bug#45898: 27.1; wedged in redisplay again
Date: Sat, 25 Jun 2022 11:49:42 +0200	[thread overview]
Message-ID: <56F03F59-40AD-48F2-92C8-9858C2423327@gmail.com> (raw)
In-Reply-To: <83r13db6hp.fsf@gnu.org>



> On 2022-06-25,, at 8:29 , Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> One of the first things that came to my mind is a new category "time fuse" (in German Zeitzünder),
>> something counting ticks, and detonating (signaling) at some point.  I admit that I find the names you used
>> with redisplay in them confusing.  Especially in the regexp code and so.
> 
> That's mainly to keep the names from getting too long to be useful.  I
> could have used something like update_display_code_iteration_ticks,
> but it looked to me that "redisplay" is a good way of saying "display
> code" shorter.

Well... update_display_code_iteration_ticks also makes me twitch because I think of the tick/signal business not part of "display".  What I have in my head is regexp -> ticks, and iterator -> ticks, where "ticks" would be replaced with some suitable name. I think regexp should also be interrupted with long lines, when we match a line that is too long.  Or not?

Or maybe "ticks" is already a good enough name?  We could then simply have update_ticks and good.  Or eticks to not confuse it with time ticks, if that ever happens.

> 
>> Functionality-wise, Iterator now signals an error that redisplay catches. 
> 
> Yes, that's the main idea.  But note that in some cases Iterator is
> called directly from Lisp, not from Redisplay, in which case the error
> is caught by the command loop (not sure where that is in your
> taxonomy? is that also Lisp?), not by Redisplay.  Case in point: C-n.

Yes, that's what I meant by lisp -> iterator, using the move_it* "API".

I left out the command-loop, but it's also something I'd consider a category.

> 
>> The error is signaled when a global tick counter exceeds a max value.  Each movement of an iterator
>> increments the global tick counter.  The counter is global because you want to sum up all the ticks that
>> occur between a given start point where the tick counter is set to 0, and the point where the ticks exceed the
>> maximum, regardless of iterator -> lisp -> iterator nesting.
>> 
>> The global tick counter is also incremented from regexp.  I think font-lock plays a role here.  One scenario is
>> redisplay or lisp -> iterator, iterator needs font-lock to run (-> lisp), font-lock matches a regexp (lisp ->
>> regexp), and we get stuck on a long line.  Likewise with other stuff, like syntax.
> 
> Right.  But I want to explain why I count ticks in regexp, in
> syntax.c, and in some places in bidi.c.  The reason is that a single
> call to set_iterator_to_next, which basically counts as one tick, can
> sometimes result in prolonged operations.  So some ticks are "more
> equal" than others, and I looked for a way of expressing that.  What
> you see in those other places is the result of that: it makes
> iteration steps that trigger prolonged examination of buffer text to
> count as more than one tick.

I've seen that, and I think that's fine.

> 
>> (BTW, the call to update the tick in regexp can lead to a GC when the error is signaled, in the same way as
>> in bug 56108 with maybe_quit.  So we might need that, too.)
> 
> Yes, it could cause GC, but I'm not sure what you mean by "we might
> need that".  What is "that" here?  

I meant a fix for that bug.  

Might be something specific to German.  People say "I need that bug for the next release", and mean the fix, because they have the bug already :-).

> Did you mean we should count ticks
> inside GC as well?  If so, we'd need to have some way of preventing a
> signal when the tick count reaches the threshold, because we cannot
> signal an error inside GC.

No, I didn't think of that.

>> The meaning of display_working_on_window_p is not clear to me.  I see what setting it does in the end, but I
>> can't tell what this means:
>> 
>> /* True while some display-engine code is working on layout of some
>>   window.
> 
> The reason for that kludge is the urge to avoid signaling an error
> when regexp or syntax.c is called in the context that is not related
> to any display code whatsoever.  Since these functions don't know
> whether they are invoked by some code in Iterator or by Lisp, they
> will count the ticks regardless, and I don't want them to signal an
> error if they happen to count too many ticks.

You mean a case, where small numbers of ticks sum up by calling these Lisp functions often enough?

> 
>> Do you want me to take a deeper look at specific places?
> 
> As you wish.  I just wanted a second opinion on the overall design,
> and my main worry besides that is whether there are situations where
> this simple mechanism could cause trouble.  E.g., Lars already
> uncovered one such situation, see
> 
>  https://lists.gnu.org/archive/html/emacs-diffs/2022-06/msg00761.html
> 
> (I will redirect that to here, as emacs-diffs is not for discussions
> of this sort.)

Apart from features I don't know, I don't see any fundamental problem with your approach.







  parent reply	other threads:[~2022-06-25  9:49 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 18:13 bug#45898: 27.1; wedged in redisplay again Devon Sean McCullough
2022-06-07 13:37 ` Lars Ingebrigtsen
2022-06-07 14:00   ` Eli Zaretskii
     [not found]     ` <b7f81bfc-bbfb-83bc-3660-d0b1474498f7@jovi.net>
2022-06-07 15:53       ` Eli Zaretskii
2022-06-08 11:47     ` Lars Ingebrigtsen
2022-06-08 14:08       ` Eli Zaretskii
2022-06-08 15:58         ` Eli Zaretskii
2022-06-09 10:30           ` Lars Ingebrigtsen
2022-06-09 10:45             ` Eli Zaretskii
2022-06-09 11:04               ` Lars Ingebrigtsen
2022-06-09 13:09                 ` Eli Zaretskii
2022-06-09 13:36                   ` Lars Ingebrigtsen
2022-06-09 15:56                     ` Eli Zaretskii
2022-06-10  9:02                       ` Lars Ingebrigtsen
2022-06-12  9:48                         ` Eli Zaretskii
2022-06-12 10:23                           ` Lars Ingebrigtsen
2022-06-12 14:23                             ` Eli Zaretskii
2022-06-12 18:02                               ` Eli Zaretskii
2022-06-13 12:10                               ` Lars Ingebrigtsen
2022-06-13 12:57                                 ` Eli Zaretskii
2022-06-13 22:40                                   ` Phil Sainty
2022-06-14 12:45                                     ` Eli Zaretskii
2022-06-18  8:01                                       ` Eli Zaretskii
2022-06-20 11:58                                         ` Eli Zaretskii
2022-06-20 19:11                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-21 10:14                                             ` Eli Zaretskii
2022-06-21 20:38                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-22  2:33                                           ` Eli Zaretskii
2022-06-22 23:39                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-23  6:08                                               ` Eli Zaretskii
2022-06-23 21:14                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-24  7:57                                                   ` Eli Zaretskii
2022-06-25  4:54                                                     ` Gerd Möllmann
2022-06-25  6:29                                                       ` Eli Zaretskii
2022-06-25  7:47                                                         ` Eli Zaretskii
2022-06-25  8:18                                                           ` Gerd Möllmann
2022-06-25  9:49                                                         ` Gerd Möllmann [this message]
2022-06-25  9:57                                                           ` Eli Zaretskii
2022-06-25 11:10                                                             ` Gerd Möllmann
2022-06-25 11:29                                                               ` Eli Zaretskii
2022-06-25 12:20                                                                 ` Gerd Möllmann
2022-06-25 12:54                                                                   ` Eli Zaretskii
2022-06-25 12:57                                                                     ` Gerd Möllmann
2022-06-29 16:18                                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 19:07                                                       ` Eli Zaretskii
2022-06-29 21:07                                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-30  5:14                                                           ` Eli Zaretskii
2022-06-30 17:22                                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-30 18:35                                                               ` Eli Zaretskii
2022-06-30 19:56                                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01  4:42                                                                   ` Gerd Möllmann
2022-07-01  6:04                                                                     ` Eli Zaretskii
2022-07-01  8:49                                                                       ` Gerd Möllmann
2022-07-01 10:31                                                                         ` Eli Zaretskii
2022-07-01 11:04                                                                           ` Gerd Möllmann
2022-07-01 11:12                                                                             ` Eli Zaretskii
2022-07-01 11:33                                                                               ` Gerd Möllmann
2022-07-01 11:44                                                                       ` Gerd Möllmann
2022-07-01 12:35                                                                         ` Gerd Möllmann
2022-07-01 12:56                                                                           ` Eli Zaretskii
2022-07-01 12:39                                                                         ` Eli Zaretskii
2022-07-01  5:27                                                                   ` Eli Zaretskii
2022-07-01 12:14                                                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01 12:51                                                                       ` Eli Zaretskii
2022-07-01 14:38                                                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-01 15:43                                                                           ` Eli Zaretskii
2022-06-14 12:00                                   ` Lars Ingebrigtsen
2022-06-14 13:00                                     ` Eli Zaretskii
2022-06-09 10:25         ` Lars Ingebrigtsen
2022-06-09 10:40           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-09 10:41           ` Eli Zaretskii
2022-06-09 10:48             ` Lars Ingebrigtsen
2022-06-09 13:06               ` Eli Zaretskii
     [not found] <165605725704.24125.17210424600068379407@vcs2.savannah.gnu.org>
     [not found] ` <20220624075417.BFA82C0169C@vcs2.savannah.gnu.org>
     [not found]   ` <87wnd6v34k.fsf@gnus.org>
     [not found]     ` <83mte2coqg.fsf@gnu.org>
     [not found]       ` <87fsjuqpzi.fsf@gnus.org>
     [not found]         ` <83k096clsx.fsf@gnu.org>
     [not found]           ` <8735fup5oh.fsf@gnus.org>
     [not found]             ` <83a6a2cher.fsf@gnu.org>
     [not found]               ` <874k09nau4.fsf@gnus.org>
2022-06-25  7:17                 ` Eli Zaretskii
2022-06-25 10:10                   ` Lars Ingebrigtsen
2022-06-25 11:21                     ` 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=56F03F59-40AD-48F2-92C8-9858C2423327@gmail.com \
    --to=gerd.moellmann@gmail.com \
    --cc=45898@debbugs.gnu.org \
    --cc=eliz@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.
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).