From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang Date: Thu, 28 May 2020 21:31:15 +0200 Message-ID: References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> <87ftbjdg7n.fsf@tromey.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f04d5a05a6ba5f17" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="36804"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41441@debbugs.gnu.org, Dmitry Gutov To: Tom Tromey Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 28 21:32:17 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jeOGG-0009St-J5 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 May 2020 21:32:16 +0200 Original-Received: from localhost ([::1]:51518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jeOGF-0004wa-6E for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 28 May 2020 15:32:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jeOG2-0004wA-2h for bug-gnu-emacs@gnu.org; Thu, 28 May 2020 15:32:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jeOG1-0003We-PX for bug-gnu-emacs@gnu.org; Thu, 28 May 2020 15:32:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jeOG1-0001WU-NM for bug-gnu-emacs@gnu.org; Thu, 28 May 2020 15:32:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 May 2020 19:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41441 X-GNU-PR-Package: emacs Original-Received: via spool by 41441-submit@debbugs.gnu.org id=B41441.15906942955819 (code B ref 41441); Thu, 28 May 2020 19:32:01 +0000 Original-Received: (at 41441) by debbugs.gnu.org; 28 May 2020 19:31:35 +0000 Original-Received: from localhost ([127.0.0.1]:53098 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeOFb-0001Vn-4E for submit@debbugs.gnu.org; Thu, 28 May 2020 15:31:35 -0400 Original-Received: from mail-lj1-f170.google.com ([209.85.208.170]:46282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeOFZ-0001VZ-E8 for 41441@debbugs.gnu.org; Thu, 28 May 2020 15:31:34 -0400 Original-Received: by mail-lj1-f170.google.com with SMTP id z6so34846870ljm.13 for <41441@debbugs.gnu.org>; Thu, 28 May 2020 12:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RRzJA4uda9CcpgnGKMvcXUVH2Q7+UcENuEk5Ov7d4FU=; b=O1Yp2nBa8pn/tbsiSfv4O1AUZNHipIkphlkeXSfm3JZjEpo8dIMBQVW0GNIsBUTvbh CcFJADT+AYH5w+wQ1dOJ7OpDuSYMXDUFP3DTWmZUtkZ+nWiOf6R1cR3iIRps/RuFTUsu HtyGj0+a5DG4OdMGjiBQsoAh1Gi3ITkn07FiBaR/OYKXpa7kuUXwq9/qYtqpLudrW9Zm DZhUOPHK3CdFEyFHLDLjE3hUlbmjK67ixuEPqfCyFjbgP/z1h76ZriFuuyWCWhwJRfGp LVIHgx69BDXyrU2wnrGESHQbwbSDKv6DFl4GG/Yh0nr6OclxB5ZH/x4uFASkIwwDak2u NgRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RRzJA4uda9CcpgnGKMvcXUVH2Q7+UcENuEk5Ov7d4FU=; b=n5H7UCZJAKwentCT3XnPhrQAluNLLh35uOZ/BR3rKAqvhRZzJCwLsMNKF8yjhYuuL0 LZzmS5B3IixBm7y3LpYsJsaehT0jeUjbqPO0Sv8/Wrbf1PECDDlfWZTbsoitSUTMw8Ks Cb/c98eWSW0kTQzi/vvCUqHBOjL3RT0Xe4JSlD0OCZxnDy4GFWWoCZFNQGL9TjNmcyGo AVi8x2aJyxWFlJcPxik06mjqCcewXQpTuBxTFyf3QER4fQLCR6n90zctlI7ZQvLVZvW+ qWgrX/4I4IL4PJEInpE9oIFaxg2hFBx/3dDLwfjixkLHDiJt8Y91FvY2abwfg+vJ+wCk 5F+Q== X-Gm-Message-State: AOAM532IzBRIDh3OhXoz1HxQUIdZt+g5E0SCQefT/IKlNei568V/QosO rcZ4Ly+hF/+/udfwQVCto/PcY5s7Jb67g0z644I= X-Google-Smtp-Source: ABdhPJx2Pm1yNeMWrBzwoMv1kfagJIqLf5Qxj1t8Ia2ZCAghn2+McdL5fZnsluwfFVWCxSoOH4w+4L7ImiDiLjeNpdg= X-Received: by 2002:a2e:9105:: with SMTP id m5mr2482995ljg.408.1590694287262; Thu, 28 May 2020 12:31:27 -0700 (PDT) In-Reply-To: <87ftbjdg7n.fsf@tromey.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181159 Archived-At: --000000000000f04d5a05a6ba5f17 Content-Type: text/plain; charset="UTF-8" Hi! I have given some thought to the other end of the problem (if we should allow shrinking regions) -- how should font-lock behave when there are functions that pull in different directions (and it will also handle the case when a single function returns non-nil without changing the region). The loop could keep track of which regions it has stared with. When a functions change the region, the new region it is recorded and the loop restarts. When the region is resized into something that has already been seen it doesn't restart. This would allow the region to shrink and grow, without hanging. When having conflicting functions, the result is somewhat arbitrary. Effectively, functions later i the list take precedence over earlier, but picking one result is better than a hanging Emacs. -- Anders On Thu, May 28, 2020 at 9:15 PM Tom Tromey wrote: > >> You can enlarge (or even reduce) the region to refontify by setting > >> the following variable: > > Dmitry> This is about font-lock-extend-after-change-region-function, > though, > Dmitry> isn't it? > > Wow, I totally misread that. Yeah, I agree. > > Dmitry> If we don't find good examples, though, and if we agree that the > Dmitry> design seems sound, we can turn it off on master and see if anyone > Dmitry> complains. > > I think it would be better to try it a bit first. > > Tom > --000000000000f04d5a05a6ba5f17 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

I have given some thought to = the other end of the problem (if we should allow shrinking regions) -- how = should font-lock behave when there are functions that pull in different dir= ections (and it will also handle the case when a single function returns no= n-nil without changing the region).

The loop could keep = track of which regions it has stared=C2=A0with. When a functions change the= region, the=C2=A0new region it is recorded and the loop restarts. When the= region is resized=C2=A0into something that has already been seen it doesn&= #39;t restart. This=C2=A0would allow the region to shrink=C2=A0and grow, wi= thout hanging.

When having conflicting functions, = the result is somewhat arbitrary. Effectively, functions later i the list t= ake precedence over earlier, but picking one result is better than a hangin= g Emacs.

=C2=A0 =C2=A0 -- Anders


On Thu, May 28, 2020 at 9:15 PM Tom Tromey <tom@tromey.com> wrote:
>> You can enlarge (or even reduce) the region= to refontify by setting
>> the following variable:

Dmitry> This is about font-lock-extend-after-change-region-function, tho= ugh,
Dmitry> isn't it?

Wow, I totally misread that.=C2=A0 Yeah, I agree.

Dmitry> If we don't find good examples, though, and if we agree that= the
Dmitry> design seems sound, we can turn it off on master and see if anyo= ne
Dmitry> complains.

I think it would be better to try it a bit first.

Tom
--000000000000f04d5a05a6ba5f17--