From unknown Wed Aug 20 01:18:14 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41441 <41441@debbugs.gnu.org> To: bug#41441 <41441@debbugs.gnu.org> Subject: Status: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang Reply-To: bug#41441 <41441@debbugs.gnu.org> Date: Wed, 20 Aug 2025 08:18:14 +0000 retitle 41441 26.3; mhtml misbehaving font-lock extend region can cause Ema= cs to hang reassign 41441 emacs submitter 41441 Anders Lindgren severity 41441 normal tag 41441 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Thu May 21 16:14:20 2020 Received: (at submit) by debbugs.gnu.org; 21 May 2020 20:14:20 +0000 Received: from localhost ([127.0.0.1]:57361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbra7-0005z2-NG for submit@debbugs.gnu.org; Thu, 21 May 2020 16:14:20 -0400 Received: from lists.gnu.org ([209.51.188.17]:56614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbra4-0005yu-Rr for submit@debbugs.gnu.org; Thu, 21 May 2020 16:14:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jbra4-0003rX-M0 for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 16:14:16 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:45575) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jbra2-0002ud-RL for bug-gnu-emacs@gnu.org; Thu, 21 May 2020 16:14:16 -0400 Received: by mail-lj1-x229.google.com with SMTP id z18so9841342lji.12 for ; Thu, 21 May 2020 13:14:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ZeCKvJ7Z7FzIAUC8izFb3B6hyYlDsq/xxTDL2A+YRwk=; b=OQ/LZ0T20JuOIsoZaSLlfsmzalSy6TN/I+djG1kTnveklE0gtdb0372mqGq8cqJ02r GGA/9FggzgltBi1NElWK4jluIS1/v+mgy3RYaam0g8AYhU1B8xsmFXb7xY428xZ2jOTE si1Ym4JFsh+gOGGNmK7Js0dqJe6wrkaoOdoG+363ra3Uqs3RPI+H2gZ4LmkvA9V9m6Qf Afpx76hQGWPB3emOWQ4CUmKx7OPp82MO7vT7mppEbH8zYQcj3OxqlUZ/jVslwSOkbSQr KmmPy3FktcEn3lxxnuta/o/Nfa04hvlDgfjMl+AwI0pPOM0aLVxb0KyQrZYT7b6++NQU xZgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ZeCKvJ7Z7FzIAUC8izFb3B6hyYlDsq/xxTDL2A+YRwk=; b=BRSOkvjvm1bZyI0Y4yyvOZbg2Yh2X9uLsrB0fNgRCrZdojo2zV0kVTjEzOzlQLF8Z9 03/ua+amKdDoGbzXzEed2ar83jynX5NbI1y0yZoBuTjtWV3cYDY4m1A2UTQDaSrMAznl MXVTBUEWtKjBtx7KFxJ47aUhY86IScTD/h+MJNVDsbxK97t3w/bK4LpLPOzRfTAaBF57 D6JTE+Np7OqdTqv18eNKlFjsqskcXMZuiurYbvzVLS2jWAUrO01ymmn6qE0pWhySrU92 /yRaZZNCzFY4/Q3dUpf7kqb8YYSWQEl67u7qcLZ+H8Ow59q8c4oHxcQxo2I8cRiSnyfB j1Nw== X-Gm-Message-State: AOAM530n2JepWuKlip9fpigWoqHCtNztk4uxFGZKF65DdQjnAPUo/68A AlwOSpK8uuv50LEc/yYFCssnk70VP9GfzBX/3UxvLdFo/uQ= X-Google-Smtp-Source: ABdhPJyzFXCrd68/gW6Pn84K8/hRWjCLYbEWWYxnxiXxCAomz4VzgZh4sykbYd0fTpelQKu0fw5ohSYSamcHQwmvHHk= X-Received: by 2002:a05:651c:209:: with SMTP id y9mr4039034ljn.408.1590092051861; Thu, 21 May 2020 13:14:11 -0700 (PDT) MIME-Version: 1.0 From: Anders Lindgren Date: Thu, 21 May 2020 22:14:00 +0200 Message-ID: Subject: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="000000000000e9534b05a62e2732" Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=andlind@gmail.com; helo=mail-lj1-x229.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000e9534b05a62e2732 Content-Type: text/plain; charset="UTF-8" Hi! The font-lock system provides a system for major and minor modes to extend the region that is being highlighted. In Mhtml mode, the function `mhtml--extend-font-lock-region` sometimes reduce the size of the region. If this is combined with, say, a minor mode that extends the region then Emacs could hang. Steps to repeat: Create a file, test.html, with the following content: --------- alpha beta --------- Evaluate: (let ((font-lock-beg 7) (font-lock-end 13)) (mhtml--extend-font-lock-region) (cons font-lock-beg font-lock-end)) The 7 and 13 corresponds to a region that includes the last two lines. The expression returns (8 . 13) representing a region that only include the last line. If this is combined with another function that extends the region to include line 2, Emacs hangs. I suggest that: * Modify the documentation of the variable `font-lock-extend-region-functions` so that it's clear that the region should not shrink. * Add a check in the function `font-lock-default-fontify-region` to prevent the region from shrinking even if a function tries to do so. (By ensuring that the region only extends and never shrinks, the function will always terminate.) * Fix the problem in `mhtml--extend-font-lock-region`. One minor mode that, when enabled, would cause Emacs to hang with the above buffer is https://github.com/Lindydancer/char-font-lock (this package highlights incorrect whitespace). -- Anders Lindgren 1) The function `mhtml--extend-font-lock-region should be modified so that it never shrinks the region. In GNU Emacs 26.3 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511)) of 2019-09-02 built on builder10-10.porkrind.org Windowing system distributor 'Apple', version 10.3.1348 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. (New file) funcall-interactively: End of buffer Saving file /Users/anders/emacs/src/foreach/foo.html... Wrote /Users/anders/emacs/src/foreach/foo.html Char: C-j (10, #o12, #xa) point=7 of 12 (50%) column=0 Quit Entering debugger... Back to top level (8 . 13) [2 times] Configured using: 'configure --with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS Important settings: value of $LC_CTYPE: UTF-8 value of $LANG: en_SE.UTF-8 locale-coding-system: utf-8-unix Major mode: HTML+ Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cl-print debug help-fns radix-tree help-mode vc-dispatcher vc-svn mhtml-mode css-mode smie color js advice json map imenu thingatpt cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs sgml-mode seq byte-opt gv bytecomp byte-compile cconv dom cl-loaddefs cl-lib elec-pair time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 244001 21210) (symbols 48 23926 1) (miscs 40 81 268) (strings 32 43844 1478) (string-bytes 1 1234265) (vectors 16 39716) (vector-slots 8 775521 10394) (floats 8 209 245) (intervals 56 230 0) (buffers 992 14)) --000000000000e9534b05a62e2732 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

The font-lock system provides a sys= tem for major and minor modes to extend the region that is being highlighte= d.

In Mhtml mode, the function `mhtml--extend-font= -lock-region` sometimes reduce the size of the region. If this is combined = with, say, a minor mode that extends the region then Emacs could hang.

Steps to repeat:

Create a fil= e, test.html, with the following content:

--------= -
alpha

beta
---------

=
Evaluate:

(let ((font-lock-beg 7)
= =C2=A0 =C2=A0 =C2=A0 (font-lock-end 13))
=C2=A0 (mhtml--extend-font-lock= -region)
=C2=A0 (cons font-lock-beg font-lock-end))

The 7 and 13 = corresponds to a region that includes the last two lines. The expression re= turns (8 . 13) representing a region that only include the last line. If th= is is combined with another function that extends the region to include lin= e 2, Emacs hangs.

I suggest that:

* Modify the documentation of the variable `font-lock-extend-regio= n-functions` so that it's clear that the region should not shrink.

* Add a check in the function `font-lock-default-fonti= fy-region` to prevent the region from shrinking even if a function tries to= do so. (By ensuring that the region only extends and never shrinks, the fu= nction will always terminate.)

* Fix the problem i= n `mhtml--extend-font-lock-region`.

One minor mode= that, when enabled, would cause Emacs to hang with the above buffer is https://github.com/L= indydancer/char-font-lock (this package highlights incorrect whitespace= ).

=C2=A0 =C2=A0 -- Anders Lindgren

=



1) The function `mh= tml--extend-font-lock-region should be modified so that it never shrinks th= e region.

=C2=A0
In GNU Emacs 26.3 (build 1, x8= 6_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))=
=C2=A0of 2019-09-02 built on builder10-10.porkrind.org
Windowing system distributor 'Apple= ', version 10.3.1348
Recent messages:
For information about GNU E= macs and the GNU system, type C-h C-a.
(New file)
funcall-interactive= ly: End of buffer
Saving file /Users/anders/emacs/src/foreach/foo.html..= .
Wrote /Users/anders/emacs/src/foreach/foo.html
Char: C-j (10, #o12,= #xa) point=3D7 of 12 (50%) column=3D0
Quit
Entering debugger...
B= ack to top level
(8 . 13) [2 times]
Configured using:
=C2=A0'c= onfigure --with-ns '--enable-locallisppath=3D/Library/Application
= =C2=A0Support/Emacs/${version}/site-lisp:/Library/Application
=C2=A0Supp= ort/Emacs/site-lisp' --with-modules'

Configured features:NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
<= br>Important settings:
=C2=A0 value of $LC_CTYPE: UTF-8
=C2=A0 value = of $LANG: en_SE.UTF-8
=C2=A0 locale-coding-system: utf-8-unix

Maj= or mode: HTML+

Minor modes in effect:
=C2=A0 tooltip-mode: t
= =C2=A0 global-eldoc-mode: t
=C2=A0 electric-indent-mode: t
=C2=A0 mou= se-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
= =C2=A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2= =A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2=A0 auto-composi= tion-mode: t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compression-m= ode: t
=C2=A0 line-number-mode: t
=C2=A0 transient-mark-mode: t
Load-path shadows:
None found.

Features:
(shadow sort mail-e= xtr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mm= l mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmai= l-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev g= mm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prs= vr mail-utils cl-print debug help-fns
radix-tree help-mode vc-dispatcher= vc-svn mhtml-mode css-mode smie color
js advice json map imenu thingatp= t cc-mode cc-fonts easymenu cc-guess
cc-menus cc-cmds cc-styles cc-align= cc-engine cc-vars cc-defs sgml-mode
seq byte-opt gv bytecomp byte-compi= le cconv dom cl-loaddefs cl-lib
elec-pair time-date tooltip eldoc electr= ic uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-wi= n ucs-normalize mule-util
term/common-win tool-bar dnd fontset image reg= exp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode li= sp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer selec= t
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/= tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnames= e tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew gree= k romanian slovak czech european ethiopic indian cyrillic
chinese compos= ite charscript charprop case-table epa-hook jka-cmpr-hook
help simple ab= brev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-f= ace macroexp files text-properties overlay sha1 md5
base64 format env co= de-pages mule custom widget hashtable-print-readable
backquote threads k= queue cocoa ns multi-tty make-network-process emacs)

Memory informat= ion:
((conses 16 244001 21210)
=C2=A0(symbols 48 23926 1)
=C2=A0(m= iscs 40 81 268)
=C2=A0(strings 32 43844 1478)
=C2=A0(string-bytes 1 1= 234265)
=C2=A0(vectors 16 39716)
=C2=A0(vector-slots 8 775521 10394)<= br>=C2=A0(floats 8 209 245)
=C2=A0(intervals 56 230 0)
=C2=A0(buffers= 992 14))
--000000000000e9534b05a62e2732-- From debbugs-submit-bounces@debbugs.gnu.org Mon May 25 12:11:09 2020 Received: (at 41441) by debbugs.gnu.org; 25 May 2020 16:11:09 +0000 Received: from localhost ([127.0.0.1]:42276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdFgy-0008St-QS for submit@debbugs.gnu.org; Mon, 25 May 2020 12:11:09 -0400 Received: from gateway36.websitewelcome.com ([192.185.197.22]:18935) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdFgv-0008SJ-UB for 41441@debbugs.gnu.org; Mon, 25 May 2020 12:11:07 -0400 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 542E840CC6A21 for <41441@debbugs.gnu.org>; Mon, 25 May 2020 10:30:52 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id dFgujJQfsEfyqdFguj04ev; Mon, 25 May 2020 11:11:05 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=51qtUDT76OtztpEhC/eBKwe6PLJTDSV1qVpiyXq5gu8=; b=PBzABMPFWVlSq8Zbk/BxiGwfWC 3KatFgruYVt6mL+YMhX6bmUWLm0FLWWw5TIeGx5mnPqKOLAWxqrQ73Xon6YacPd0AAGIF413jzhgi F7ER7CcZVHgarxEKqA3OwcI37; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:36022 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jdFgu-003vWS-H2; Mon, 25 May 2020 10:11:04 -0600 From: Tom Tromey To: Anders Lindgren Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang References: X-Attribution: Tom Date: Mon, 25 May 2020 10:11:03 -0600 In-Reply-To: (Anders Lindgren's message of "Thu, 21 May 2020 22:14:00 +0200") Message-ID: <87pnasro4o.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jdFgu-003vWS-H2 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya) [174.16.104.48]:36022 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Anders> * Fix the problem in `mhtml--extend-font-lock-region`. It's not entirely clear to me that (1) this is a bug, or (2) that it can be changed. My recollection is that mhtml mode has to shrink the region in some cases, because we don't want font-locking to extend beyond the end of a sub-mode. For example consider things like

more html here

Here, we want to font-lock the body of the script using one set of rules, and the rest with another set. Looking at mhtml--submode-fontify-region, though, I wonder if maybe region extension isn't needed at all, since that function seems to handle sub-mode region boundaries. So I guess that is one experiment that could be done. Anders> One minor mode that, when enabled, would cause Emacs to hang Anders> with the above buffer is Anders> https://github.com/Lindydancer/char-font-lock (this package Anders> highlights incorrect whitespace). Maybe this mode could be changed instead. Tom From debbugs-submit-bounces@debbugs.gnu.org Wed May 27 16:41:30 2020 Received: (at 41441) by debbugs.gnu.org; 27 May 2020 20:41:30 +0000 Received: from localhost ([127.0.0.1]:50076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je2rT-0002bu-Fp for submit@debbugs.gnu.org; Wed, 27 May 2020 16:41:30 -0400 Received: from mail-lf1-f53.google.com ([209.85.167.53]:46239) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je2rQ-0002bf-Ix for 41441@debbugs.gnu.org; Wed, 27 May 2020 16:41:13 -0400 Received: by mail-lf1-f53.google.com with SMTP id r125so15236507lff.13 for <41441@debbugs.gnu.org>; Wed, 27 May 2020 13:41:12 -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=cDLEkBnCjFd0nrPHCHuaj+D1yPY3ZVH6zc08RhfR2Mc=; b=p8pdBM9k4K5wmQKfM4oGDluoItniiXHkBlTgzwzLR4zRyJiFRvjEp2JhAGzPdwQ/h3 NuLFhwUvP77ETf/FRcmzaCAPlGd6Q2nQZe4gpDw/Z20h4ROYLEDXn6+4uTCeQ6zf+cxt 8ZtD6nLuvp8XOay9C5AmvbE5VtMWO3YcapvK/trkKvRNnwXGKrVRNh5O9wVCpsWDs42R bGYw1QCaWbccKw97oLOOzSKZVTeUFZCkj68SvnRwaRPzbp3jAylm6pIebZWnxPwHcEEd 7PlbdyUGdzWe9mj6tLUy66sB49lqNORL1WO0X/mCUjyfvmOsDLwrtLFpFFW3r69MtJz/ /XUw== 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=cDLEkBnCjFd0nrPHCHuaj+D1yPY3ZVH6zc08RhfR2Mc=; b=Pls84k3ATj6luuTam0rHgzrz9BA/s9o1MlmCS81vStV3vWVt1UTQOLucv/CJJiBIc/ aQFRO+yea6LW8JNd26hnw2GTjWnsmmMAvMLD+FnubzS+SQDVZPP81rPJNK3E/EY5p5Dg stXFLmx/Pg7E+BvWJIAEvs3pU3PBCzr9LL/yAt8Cj+dzMHPQVdukoKNnw/iMa3ullQ7a XH81RBQZvXto5HLY6vKaKt7BqMJ8Odh+7cvTyDsKEfAzFlgg8IiPicstqg4p1lUqE3ZI JAfwd0MALmrd9wPLTdBUc1ZcFXlE9YgowLj5np1i9wW54uD/WJ75rGFVAAUW/yNl+Iab 1tKA== X-Gm-Message-State: AOAM533SZWazaqsNMwV521pvfiWdw0unGiBgJ5GlnfUg8nxZ3knmdBF8 4BShyfL3UZxfvy5JsJe8fZxbpakBlaTS7t1UJnQO3sXO X-Google-Smtp-Source: ABdhPJw+9s5LUdZeT5f0S4Gmlmz01lfef8EoIGUeIT8UfdRxiSiUocV4EHkPJeUfzt5uN6IMHYvWyI+vDNbEf01kEuo= X-Received: by 2002:ac2:550a:: with SMTP id j10mr3879362lfk.46.1590612066354; Wed, 27 May 2020 13:41:06 -0700 (PDT) MIME-Version: 1.0 References: <87pnasro4o.fsf@tromey.com> In-Reply-To: <87pnasro4o.fsf@tromey.com> From: Anders Lindgren Date: Wed, 27 May 2020 22:40:55 +0200 Message-ID: Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: Tom Tromey Content-Type: multipart/alternative; boundary="00000000000030c90d05a6a73bd5" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --00000000000030c90d05a6a73bd5 Content-Type: text/plain; charset="UTF-8" Hi! To me it's obviously a bug. First, the name of the function contains "extend", not "change". Secondly, the loop in font-lock-default-fontify-region is written so that it loops until all functions in font-lock-extend-region-functions are satisfied (which is also documented). To me, when code is written this way it's clear that monotonic growth of the region is assumed (even though that isn't explicitly stated in the documentation). Anyway, I took a look at the mhtml code today. This is from mhtml--extend-font-lock-region: (goto-char font-lock-beg) (unless (eobp) (forward-char)) (setq font-lock-beg (previous-single-property-change (point) 'mhtml-submode nil (line-beginning-position))) Without having a deep knowledge of this, I don't think this do the correct thing when font-lock-beg is at the end of a line (as it is when the line is empty). The problem is that the code move forward one character (the newline) and then search backward with line-beginning-position (i.e. the beginning of the line following the original font-lock-beg) as limit, effectively shrinking the region. On Mon, May 25, 2020 at 6:11 PM Tom Tromey wrote: > Anders> * Fix the problem in `mhtml--extend-font-lock-region`. > > It's not entirely clear to me that (1) this is a bug, or (2) that it can > be changed. > > My recollection is that mhtml mode has to shrink the region in some > cases, because we don't want font-locking to extend beyond the end of a > sub-mode. > > For example consider things like > >

more html here

> > Here, we want to font-lock the body of the script using one set of > rules, and the rest with another set. > > Looking at mhtml--submode-fontify-region, though, I wonder if maybe > region extension isn't needed at all, since that function seems to > handle sub-mode region boundaries. So I guess that is one > experiment that could be done. > > Anders> One minor mode that, when enabled, would cause Emacs to hang > Anders> with the above buffer is > Anders> https://github.com/Lindydancer/char-font-lock (this package > Anders> highlights incorrect whitespace). > > Maybe this mode could be changed instead. Unfortunately, with the current font-lock interface, it's not. (Well, at least I haven't figured out a way to do it, and I've been writing Emacs packages for 25 years.) The problem is that when the "expand" function is called, the functions has no way of knowing whether it's the first time it has been called, or if it has been called repeatedly. Besides, what should it do if there is another expand function that has adjusted the region in the opposite order? Who has the right of way? Anyway, it's not just a problem for this mode, but for all font-lock packages that expand the region. -- Anders > > Tom > --00000000000030c90d05a6a73bd5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

To me it's obviously= a bug. First, the name of the function contains "extend", not &q= uot;change". Secondly, the loop in font-lock-default-fontify-region is= written so that it loops until all functions in font-lock-extend-region-fu= nctions are satisfied (which is also documented). To me, when code is writt= en this=C2=A0way it's clear that monotonic growth of the region is assu= med (even though that isn't explicitly stated in the documentation).

Anyway, I took a look at the mhtml code today. This = is from mhtml--extend-font-lock-region:

     =
 (goto-char font-lock-beg)
      (unless (eobp)
        (forward-char))
      (setq font-lock-beg (prev=
ious-single-property-change
                           (point) 'mhtml-submode nil
                           (line-beginning-position)))
Without having a deep knowledge of this, I don't think= this do the correct thing when font-lock-beg is at the end of a line (as i= t is when the line is empty). The problem is that the code move forward one= character (the newline) and then search backward with line-beginning-posit= ion (i.e. the beginning of the line following the original font-lock-beg) a= s limit, effectively shrinking the region.


On Mon,= May 25, 2020 at 6:11 PM Tom Tromey <tom@tromey.com> wrote:
Anders> * Fix the problem in `mhtml--ex= tend-font-lock-region`.

It's not entirely clear to me that (1) this is a bug, or (2) that it ca= n
be changed.

My recollection is that mhtml mode has to shrink the region in some
cases, because we don't want font-locking to extend beyond the end of a=
sub-mode.

For example consider things like

<script>some js here;</script><p>more html here</p>=

Here, we want to font-lock the body of the script using one set of
rules, and the rest with another set.

Looking at mhtml--submode-fontify-region, though, I wonder if maybe
region extension isn't needed at all, since that function seems to
handle sub-mode region boundaries.=C2=A0 So I guess that is one
experiment that could be done.

Anders> One minor mode that, when enabled, would cause Emacs to hang
Anders> with the above buffer is
Anders> https://github.com/Lindydancer/char-font-loc= k (this package
Anders> highlights incorrect whitespace).

Maybe this mode could be changed instead.

U= nfortunately, with the current font-lock interface, it's not. (Well, at= least I haven't figured out a way to do it, and I've been writing = Emacs packages for 25 years.)

The problem is that = when the "expand" function is called, the=C2=A0functions has no w= ay of knowing whether it's the first time it has been called, or if it = has been called repeatedly. Besides, what should it do if there is another = expand function that has adjusted the region in the opposite order? Who has= the right of way?

Anyway, it's not just a pro= blem for this mode, but for all font-lock packages that expand=C2=A0the reg= ion.

=C2=A0 =C2=A0 -- Anders
=C2=A0

Tom
--00000000000030c90d05a6a73bd5-- From debbugs-submit-bounces@debbugs.gnu.org Wed May 27 17:32:25 2020 Received: (at 41441) by debbugs.gnu.org; 27 May 2020 21:32:25 +0000 Received: from localhost ([127.0.0.1]:50174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je3ez-0008Cr-FW for submit@debbugs.gnu.org; Wed, 27 May 2020 17:32:25 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:53548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1je3ex-00088h-5b for 41441@debbugs.gnu.org; Wed, 27 May 2020 17:32:23 -0400 Received: by mail-wm1-f47.google.com with SMTP id l26so1062940wme.3 for <41441@debbugs.gnu.org>; Wed, 27 May 2020 14:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zi2f0mEfeTshxpFhqTOwWHvx3Bq7GLRDnAfDtleubxQ=; b=XVI14kwXaEb2one74jF2tJl3PLQ9Lkbx7feu9WsT8mw/Iul2c4ro4jcQ/+/fcb0mw5 xU53cuvCab0nX/RwBR9BPC0aQ2E4RYFyxwxT7JkEvurKmAixQuagCyAa/bHxSkYlMvO8 n3fhYijpyCQuik9KueayTpVMxOOG2yb5N2tBJokcifmSAkB90rZsVL6ARas/wjngiyzV syqq8N5h5Ys9CUc2lGElXVqlyUzbTY5a7gjIOQG/AazQ1ewyFWC41s8RStGFPeqHtm55 k6TCl5LjciKYLpZM2dS3eTWynovo1xu3poTeEtfapPlyfUJSVe+yxMnWCr76eLMizNMB J/Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zi2f0mEfeTshxpFhqTOwWHvx3Bq7GLRDnAfDtleubxQ=; b=GkSZ5YOzikEM08EmgHlkexy6yiSTGgFD5zJoT0IxHR+rsmJlIvao2x9yMkF/+P/din WucPjkrJ8GNdTIGwj8ogTszOS23eMQ7ESG/QnbmcqB5yofBwwekJm1jeDikZALzLsBpp wAKiKsuE5Xs8KRQv9uR9/zbO1CDx2sfwYUYJYMTwYYdpgkHbjfriR/4SbElZWJCDImU+ 4bip5zNoKb3v1keX+drXWJ7jQNzYkMhMpIKbovrQx+5lJjCbBNxxTnWCX+4gfuX3AvaW EZEJJoId9TPEgphsLBXmEalLtufq1G8qiWy9sTWODOLZQ5hBiVnjQqcQqf3itOOz6rO4 VcvQ== X-Gm-Message-State: AOAM531hPpGMZdZQYeF7MlktZdkhbfhzhG6Qg7tRQkAjjmVC2pf9kWMk agjbnY4G42/16+tk2KG31MEFGIGc X-Google-Smtp-Source: ABdhPJw2nI9PQ8v8emk6K2w4t2btY75W+8xfT+VGOTKSnOtHEHDYRCnBVMnGZ90NkIr4uVCGbGHXOQ== X-Received: by 2002:a1c:1f41:: with SMTP id f62mr117930wmf.84.1590615136961; Wed, 27 May 2020 14:32:16 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id u130sm4177082wmg.32.2020.05.27.14.32.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 May 2020 14:32:16 -0700 (PDT) Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: Tom Tromey , Anders Lindgren References: <87pnasro4o.fsf@tromey.com> From: Dmitry Gutov Message-ID: Date: Thu, 28 May 2020 00:32:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87pnasro4o.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 25.05.2020 19:11, Tom Tromey wrote: > Looking at mhtml--submode-fontify-region, though, I wonder if maybe > region extension isn't needed at all, since that function seems to > handle sub-mode region boundaries. So I guess that is one > experiment that could be done. That makes sense to me, and mirrors what mmm-mode currently does. What if we just remove mhtml--extend-font-lock-region? Can anyone describe a scenario that would become broken? From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 12:13:46 2020 Received: (at 41441) by debbugs.gnu.org; 28 May 2020 16:13:47 +0000 Received: from localhost ([127.0.0.1]:52900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeLA7-00057u-5u for submit@debbugs.gnu.org; Thu, 28 May 2020 12:13:46 -0400 Received: from gateway33.websitewelcome.com ([192.185.145.24]:32396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeLA5-00057l-6y for 41441@debbugs.gnu.org; Thu, 28 May 2020 12:13:41 -0400 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 93186F9E7BE for <41441@debbugs.gnu.org>; Thu, 28 May 2020 11:13:40 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id eLA4j6W221s2xeLA4jaP0r; Thu, 28 May 2020 11:13:40 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/+x6cXiL/vwfNoO61dTXvqUwyxiYqxoCiaK/c6OFL4c=; b=OUkFq4HcraRNYoAGFTG8WXI4TO PTaBysF7xsd8Ay43LUc++15v2bwnp3TDidUyxLGDpcF+23zN1NzfLBTdndNHcMZ0MRtejTainaYHA Hz2y8cr6phUa4sn2oP5HpdV/P; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:43102 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jeLA4-000TFW-7V; Thu, 28 May 2020 10:13:40 -0600 From: Tom Tromey To: Anders Lindgren Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang References: <87pnasro4o.fsf@tromey.com> X-Attribution: Tom Date: Thu, 28 May 2020 10:13:39 -0600 In-Reply-To: (Anders Lindgren's message of "Wed, 27 May 2020 22:40:55 +0200") Message-ID: <87mu5sf364.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jeLA4-000TFW-7V X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (murgatroyd) [174.16.104.48]:43102 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org, Tom Tromey X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Anders> Hi!To me it's obviously a bug. First, the name of the Anders> function contains "extend", not "change". Yes, but the manual says: You can enlarge (or even reduce) the region to refontify by setting the following variable: See (info "(elisp) Region to Refontify") Anders> Without having a deep knowledge of this, I don't think this Anders> do the correct thing when font-lock-beg is at the end of a line Anders> (as it is when the line is empty). The problem is that the code Anders> move forward one character (the newline) and then search Anders> backward with line-beginning-position (i.e. the beginning of the Anders> line following the original font-lock-beg) as limit, effectively Anders> shrinking the region. IIRC this weird thing was needed to correctly find the spot where the property change really occurred, without having trouble when starting exactly on the boundary. I don't remember the test case. Not sure if the self-tests cover this; maybe it's archived in a bug somewhere though. Tom From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 12:14:33 2020 Received: (at 41441) by debbugs.gnu.org; 28 May 2020 16:14:33 +0000 Received: from localhost ([127.0.0.1]:52904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeLAu-00059T-WB for submit@debbugs.gnu.org; Thu, 28 May 2020 12:14:33 -0400 Received: from gateway36.websitewelcome.com ([50.116.126.2]:13279) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeLAq-00059G-Gc for 41441@debbugs.gnu.org; Thu, 28 May 2020 12:14:31 -0400 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway36.websitewelcome.com (Postfix) with ESMTP id 4176F43BF7F6D for <41441@debbugs.gnu.org>; Thu, 28 May 2020 10:34:25 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id eLApjq1QfAGTXeLApj2LH3; Thu, 28 May 2020 11:14:27 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CqnnZTq+7kZ/QDkdwxwHE1lZrj6OgyuUEVrIhX/Nzss=; b=g7RHK9q7Nj5tXcat5+oJtNuara 8Po7sHHoNm9PqWR8bT7kNd9SNMjyKxWFgh/A9t3D2q5NT3Sw5ektti+aeD9JAAFvxdLn5KzMV9Xus Zxa6oTHCAEQZigebMpJfGe8oS; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:43108 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jeLAp-000TgW-IV; Thu, 28 May 2020 10:14:27 -0600 From: Tom Tromey To: Dmitry Gutov Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang References: <87pnasro4o.fsf@tromey.com> X-Attribution: Tom Date: Thu, 28 May 2020 10:14:26 -0600 In-Reply-To: (Dmitry Gutov's message of "Thu, 28 May 2020 00:32:15 +0300") Message-ID: <87imggf34t.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jeLAp-000TgW-IV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (murgatroyd) [174.16.104.48]:43108 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org, Tom Tromey , Anders Lindgren X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Dmitry> What if we just remove mhtml--extend-font-lock-region? Can anyone Dmitry> describe a scenario that would become broken? Not offhand. Some manual testing and/or looking through the archived bugs (or maybe mailing list archives) would be needed. Tom From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 14:40:14 2020 Received: (at 41441) by debbugs.gnu.org; 28 May 2020 18:40:14 +0000 Received: from localhost ([127.0.0.1]:53027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeNRu-0000EL-2U for submit@debbugs.gnu.org; Thu, 28 May 2020 14:40:14 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]:34963) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeNRr-0000E2-LD for 41441@debbugs.gnu.org; Thu, 28 May 2020 14:40:12 -0400 Received: by mail-wm1-f46.google.com with SMTP id n5so31335wmd.0 for <41441@debbugs.gnu.org>; Thu, 28 May 2020 11:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mCGjLuIVfTAfdEWfyJkANqOW6yezZy5KNgMh/XSvcLw=; b=VLrbufBetz3khiln44JVTAtA+aBSPge8yeV9HX7+IE2xw1RnmdQLjLCscs/3L8bQJN fGjo8nS1CGaJkJAp/1va+tWhyMvdDXbgcKEk11yI8dNclB90klpaOlcwZv2fug97hvKG fWpNj0JMf+Wc39QTwcH0IwdKr+CDXkux/QU/MhunYtFch4yBBkNeeKf/iv5XHg0GzVZ5 LcrVrTQBI8dFtxjugewuwWevj8fGN48YCPnbTOrhHejY3pBILGekpLDshKZYn0V7i6Es 4IeAAWxaAEPp95Mf0+ymZp2xIVdBGwkwmGaV6RbeR99OvK3KYKYRe9XYadKYMfZQKOrB XICQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mCGjLuIVfTAfdEWfyJkANqOW6yezZy5KNgMh/XSvcLw=; b=Ivx/LlrDvF24OzZNPwEycDftSPFDpewdUXLFoIRfIOwmJ02qe8VSqrWKzWRQbrSxgs 0G4CV7GnWJsXMjBLEmPUMxtCZOEddQ1ju64Rtq0rt4j2UCZ7ZTzz9DaFIeJknqDEYYjz VjpPwYfsKVtM3KJu8blORHUDnhjmZeWeljhYgNrchcq+ihrA3rV0EqErP6LEOLCuXItu 9unbgk2Z0Im3u5mENcO/Y8B0ERjVTy/OR8fFqDI2ekxWRykslEhe2++rMH6pd1dNlSfY xWvj7BmmNPlOWyi9KaDgpW18DkjivNlCXnImcHgnrhF17fnvodQNI2rCbKUk+maPeDuY LW4Q== X-Gm-Message-State: AOAM530r+0ObE+E5rfrV8MQZjkkdEzDMrZHmw9hRn4VnUJw7hg9sTZu7 Y5TxNW91Nj5MMZKCWPvIEx4nmIQZ X-Google-Smtp-Source: ABdhPJxIlewytAt0/dePCORncc6VH4awon2OKo2twGVECjnJTyxN40GYbBEm7znXkKHMug38P81ZHg== X-Received: by 2002:a7b:c622:: with SMTP id p2mr4654956wmk.55.1590691205400; Thu, 28 May 2020 11:40:05 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id p65sm6928161wmp.36.2020.05.28.11.40.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 11:40:04 -0700 (PDT) Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: Tom Tromey , Anders Lindgren References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> From: Dmitry Gutov Message-ID: <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> Date: Thu, 28 May 2020 21:40:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87mu5sf364.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 28.05.2020 19:13, Tom Tromey wrote: > You can enlarge (or even reduce) the region to refontify by setting > the following variable: This is about font-lock-extend-after-change-region-function, though, isn't it? And since that variable is not a hook (or a list), it wouldn't be subject to inflooping problems. Though I wouldn't like this semantics for it either, given the name. > I don't remember the test case. Not sure if the self-tests cover this; > maybe it's archived in a bug somewhere though. Someone should take a look. If we don't find good examples, though, and if we agree that the design seems sound, we can turn it off on master and see if anyone complains. From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 15:14:57 2020 Received: (at 41441) by debbugs.gnu.org; 28 May 2020 19:14:57 +0000 Received: from localhost ([127.0.0.1]:53072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeNzV-00014z-0B for submit@debbugs.gnu.org; Thu, 28 May 2020 15:14:57 -0400 Received: from gateway23.websitewelcome.com ([192.185.50.107]:45987) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeNzS-00014p-SI for 41441@debbugs.gnu.org; Thu, 28 May 2020 15:14:55 -0400 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 31CE31143A5 for <41441@debbugs.gnu.org>; Thu, 28 May 2020 14:14:54 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id eNzSjAjRR1s2xeNzSjeayW; Thu, 28 May 2020 14:14:54 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=+XsQpDRP7GG9GgkF1o/HntxbPGRxM192QDuYcCwiVjk=; b=qSaoY4FZQJMx+WAnR0wvDkl4Cb 3Epps8rs2WgTtY4Nu+elUspKXJxJHSKMaflv44eC987ao1Hp+lnME8gQY1uMcFyoVYrsELLgDH6WS tddW8Y3J3yaF6OUPMezOQo/3O; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:44840 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jeNzR-0026ez-Qc; Thu, 28 May 2020 13:14:53 -0600 From: Tom Tromey To: Dmitry Gutov Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> X-Attribution: Tom Date: Thu, 28 May 2020 13:14:52 -0600 In-Reply-To: <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> (Dmitry Gutov's message of "Thu, 28 May 2020 21:40:03 +0300") Message-ID: <87ftbjdg7n.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jeNzR-0026ez-Qc X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (murgatroyd) [174.16.104.48]:44840 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org, Tom Tromey , Anders Lindgren X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) >> 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 From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 15:31:35 2020 Received: (at 41441) by debbugs.gnu.org; 28 May 2020 19:31:35 +0000 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 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 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) MIME-Version: 1.0 References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> <87ftbjdg7n.fsf@tromey.com> In-Reply-To: <87ftbjdg7n.fsf@tromey.com> From: Anders Lindgren Date: Thu, 28 May 2020 21:31:15 +0200 Message-ID: Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: Tom Tromey Content-Type: multipart/alternative; boundary="000000000000f04d5a05a6ba5f17" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --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-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 15:50:40 2020 Received: (at 41441) by debbugs.gnu.org; 28 May 2020 19:50:40 +0000 Received: from localhost ([127.0.0.1]:53118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeOY4-0001zQ-0o for submit@debbugs.gnu.org; Thu, 28 May 2020 15:50:40 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:39177) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeOY3-0001zE-2w for 41441@debbugs.gnu.org; Thu, 28 May 2020 15:50:39 -0400 Received: by mail-wr1-f49.google.com with SMTP id t18so515740wru.6 for <41441@debbugs.gnu.org>; Thu, 28 May 2020 12:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HyNFSzEIW78VQIcbAWCO6rNlKGbom/06mHIEJdj0IpA=; b=a2OeLIcyC4NLT1mThfziB5jFFm6RY8A07sLMb78BRor+5BupB+/DjtmLDXmX0zSMVK EmzCSMoe9LsgtgWHa8gbdBqvOYk9ytdyImx7me1mv7DOTygVngbHJHMF9EadvHFurOqs 2jQPP0+T89LM2b/n9SSSf7Kay+3xj3O6TV6PJxsD3OvwmGl5EtoLEAfro5tErRmbZru6 lJKnstEHC4Gdj0xD+B6eqHX4cXAxT8yYgq3u5vSfZRBBiSMcTX/8rbZXMM4GDlQuhPtL EIMdhZrnPrVf9TVCrOMBgLqKczCElMqsXzFH6JroduSF4XPv+Liv8EKcLEcQ6LVCzm1Z uhMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HyNFSzEIW78VQIcbAWCO6rNlKGbom/06mHIEJdj0IpA=; b=DtJPjRFsDKJU0EjNkS664F4grarvirvrgdMMVglXNReg1jXn5Qx/yZCNr3ffXgG3M9 /CqVKif75KkFnawZXKF0I9TLMZJ4c/9xAFNH250tmUp/WwEfOGVNulqb9tBXa3Uag9h/ TUmQHomCsK0jcKcqPtJ2mZUznw4xF2zGr4dAGs72QElcv61u481wRC12qUN/wlcxE8hD By025B8pgu1vRqr5dsMoVx8NTxP8Kgn6VETSlCfERaUB+R+xBhkpRQoBFBIFrnaE9+iz stl6MgubKalCgmDugI/mfs81F99I3e/WOW9x7q94gKOcWTElEeDjH/ObFt7dg8TrLksN Tugw== X-Gm-Message-State: AOAM5312pkWzbSoTP1K3g+iqTbX8A/zvBdgvxU2YfoEFnscZeLkPlQft mozoXAQmr1xNep+CVlAdyw1zzI0+ X-Google-Smtp-Source: ABdhPJz74Sw+ReUccbdc5nzJOQaqwobpisAj2XDpZed+BTDeGL1HFz5TdQScvfFguGhcXLJ83d6Xcw== X-Received: by 2002:a05:6000:12c4:: with SMTP id l4mr5375736wrx.128.1590695432761; Thu, 28 May 2020 12:50:32 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id u3sm7222334wrw.89.2020.05.28.12.50.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 12:50:31 -0700 (PDT) Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: Anders Lindgren , Tom Tromey References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> <87ftbjdg7n.fsf@tromey.com> From: Dmitry Gutov Message-ID: Date: Thu, 28 May 2020 22:50:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 28.05.2020 22:31, Anders Lindgren wrote: > 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. I wouldn't say a non-deterministic result is much better than hanging. We should just disallow this kind of behavior in these functions. Unless there is some very convincing evidence of its necessity. From debbugs-submit-bounces@debbugs.gnu.org Sun May 31 12:08:53 2020 Received: (at 41441) by debbugs.gnu.org; 31 May 2020 16:08:53 +0000 Received: from localhost ([127.0.0.1]:33667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfQVq-00079C-P4 for submit@debbugs.gnu.org; Sun, 31 May 2020 12:08:53 -0400 Received: from gateway21.websitewelcome.com ([192.185.45.175]:47651) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfQVl-000791-B6 for 41441@debbugs.gnu.org; Sun, 31 May 2020 12:08:37 -0400 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway21.websitewelcome.com (Postfix) with ESMTP id A5389400C5585 for <41441@debbugs.gnu.org>; Sun, 31 May 2020 11:08:32 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fQVkjYsju8vkBfQVkjAltJ; Sun, 31 May 2020 11:08:32 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bPAjlw1Rmyw3I3IR9Ck/vFMNRgy7jCGK8keFZlXrSVI=; b=Hs/MrqgYmAckN4s5RGDUvnHLUV AJ+EQYE7+7QEM8bjyvBHGNLmGmgMdeQbjF8eJUGd622Jt2X2xoM0Os1yXFtNHPWyXHGrr7gbD8XVG aTclZymANboyNr6ui/IAjgAMs; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:37110 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jfQVk-0027rx-Az; Sun, 31 May 2020 10:08:32 -0600 From: Tom Tromey To: Dmitry Gutov Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> X-Attribution: Tom Date: Sun, 31 May 2020 10:08:29 -0600 In-Reply-To: <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> (Dmitry Gutov's message of "Thu, 28 May 2020 21:40:03 +0300") Message-ID: <87pnakqe82.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jfQVk-0027rx-Az X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya) [174.16.104.48]:37110 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org, Tom Tromey , Anders Lindgren X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) Dmitry> Someone should take a look. 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 tried it out a little on some code I have here, and as far as I can tell it is ok. Also see bug #29159, where Stefan says that this function should never shrink the region -- and where I also speculate that the function is probably not needed. Funny. Soon I will install the patch to remove it. Tom From debbugs-submit-bounces@debbugs.gnu.org Sun May 31 12:28:20 2020 Received: (at control) by debbugs.gnu.org; 31 May 2020 16:28:21 +0000 Received: from localhost ([127.0.0.1]:33686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfQou-0007dH-MI for submit@debbugs.gnu.org; Sun, 31 May 2020 12:28:20 -0400 Received: from gateway34.websitewelcome.com ([192.185.148.119]:38743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfQot-0007d8-C4 for control@debbugs.gnu.org; Sun, 31 May 2020 12:28:20 -0400 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway34.websitewelcome.com (Postfix) with ESMTP id B875A344F4D0 for ; Sun, 31 May 2020 11:28:18 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id fQosjSocnVQh0fQosjSP4m; Sun, 31 May 2020 11:28:18 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sStvfAhfRSVysQmHylOqKprbpQOU93Vvz15JVin94m8=; b=hstzN4rSuxc/8WWUaaOltMsJhm gbD7Wcq9ccuI/WZ54ZCY5JYwengs02qsnXwEvnfNpQOhLPi4hhmEbB1VCZ3y+JFQmMGV0vLy8lTFc NJqivvv/YnqDSLXU2ClmHCQjw; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:35680 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1jfQos-002FkK-FV for control@debbugs.gnu.org; Sun, 31 May 2020 10:28:18 -0600 Date: Sun, 31 May 2020 10:28:17 -0600 Message-Id: <87o8q4qdb2.fsf@tromey.com> To: control@debbugs.gnu.org From: Tom Tromey Subject: control message for bug #41441 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jfQos-002FkK-FV X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya) [174.16.104.48]:35680 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) tags 41441 fixed From debbugs-submit-bounces@debbugs.gnu.org Sun May 31 13:46:57 2020 Received: (at 41441) by debbugs.gnu.org; 31 May 2020 17:46:57 +0000 Received: from localhost ([127.0.0.1]:33778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfS2q-0003CC-Mt for submit@debbugs.gnu.org; Sun, 31 May 2020 13:46:57 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:42210) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfS2p-0003By-OW for 41441@debbugs.gnu.org; Sun, 31 May 2020 13:46:48 -0400 Received: by mail-wr1-f50.google.com with SMTP id p5so3266172wrw.9 for <41441@debbugs.gnu.org>; Sun, 31 May 2020 10:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8zftJSZ7PsLt+Kx+njPnsA/HCzQ278jLjvQs+7ye/yI=; b=bxs+KdAxJIM+K+1au0TBbm/XIKUbDnvdiU6+ImKFqVJNz7zI5qemfUvjl62Rgqvk+v XEBHl61c3ZeCLXZQcfT3wMVoc7tMVJsuLNEQ69X/MydEhEwO2zU5FWKSca+u8rpdsqVY MoiOSpoDqR8VfR4l+E5oTugiHJOaO7QfqqytUIUxmZhZhcT3KhxIivXRhYmnP4XkKLgR ANLgpOt0qOdas1W+NzBL5y8whCQMtYFDpso1AyvnsxEakgMbFsGBZc+hpAG7Q39xhxtS Gnb+X4nIjOOotFePeSyvOG9Qas0ZepWdmVntEN/mpCBg62zc/qDhbhIRBhcktzddAD0G fLow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8zftJSZ7PsLt+Kx+njPnsA/HCzQ278jLjvQs+7ye/yI=; b=miZ15N4V63WnOxU58X/o2fWcjUBuV0PNRAnfJETSuBGnBIx12+4gveZFirSYlq51Pi cqVXVerhQfYoo1cYjs3Ll2IySWKApaqo009cK7OulQI78DmjjmECuOs8zbv6G92e98Ko 8PWsqz0Fq50En0Xfpeh1mOkkOTRfAz/QHpvs36AChTvjwkoZmYyNsAgxIBC7kuO3aF3f Rku/bmNtjpm/GhgCX/gVxbC9GXa/IKV9efXrUUthGoUTcF/NGtCHfrn6A9fElxTsaOL1 2/fgilVq7uDT9hHhsyTRviZ2ead76zJs5IZ2k6vUJVXBXAl4IJGevDIKrQyosMV0vhdX SOiw== X-Gm-Message-State: AOAM5314TUmD90lpJTUenlO8avereiZNR4f+eUC56vhX4R4v3icmHJqk jO6aV8j06QbxER/8+etlBa0= X-Google-Smtp-Source: ABdhPJwUXHcQNqX/6pgztPVlsUpFBwptVZkLzGQnrQsnDsyRiWqV8hj73y81h5hPG1iPjKp9/R1uaw== X-Received: by 2002:a5d:500d:: with SMTP id e13mr19520183wrt.150.1590947199748; Sun, 31 May 2020 10:46:39 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id w17sm15923930wra.71.2020.05.31.10.46.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 May 2020 10:46:39 -0700 (PDT) Subject: Re: bug#41441: 26.3; mhtml misbehaving font-lock extend region can cause Emacs to hang To: Tom Tromey References: <87pnasro4o.fsf@tromey.com> <87mu5sf364.fsf@tromey.com> <2eab0574-2504-2b27-1095-3c9025121dae@yandex.ru> <87pnakqe82.fsf@tromey.com> From: Dmitry Gutov Message-ID: <4f65cb00-6713-07cf-49a2-224ba352937d@yandex.ru> Date: Sun, 31 May 2020 20:46:37 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <87pnakqe82.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41441 Cc: 41441@debbugs.gnu.org, Anders Lindgren X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 31.05.2020 19:08, Tom Tromey wrote: > Also see bug #29159, where Stefan says that this function should never > shrink the region -- and where I also speculate that the function is > probably not needed. Funny. That happens sometimes. :-) But you seem to be speculating there about whether font-lock-extend-region-multiline is needed. Not the mhtml specific function. > Soon I will install the patch to remove it. Thanks! From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 14 13:08:53 2021 Received: (at control) by debbugs.gnu.org; 14 Feb 2021 18:08:53 +0000 Received: from localhost ([127.0.0.1]:36670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBLpF-0000cR-Ht for submit@debbugs.gnu.org; Sun, 14 Feb 2021 13:08:53 -0500 Received: from gateway34.websitewelcome.com ([192.185.148.109]:39527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBLpD-0000cJ-8N for control@debbugs.gnu.org; Sun, 14 Feb 2021 13:08:51 -0500 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway34.websitewelcome.com (Postfix) with ESMTP id C9E73142E7 for ; Sun, 14 Feb 2021 12:08:50 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id BLpClYVobHPnUBLpCl2Tm2; Sun, 14 Feb 2021 12:08:50 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:MIME-Version :Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+0diGI3isJazRVw2y7Ow6zF9y1FGrLjU7g4dEgMHpWo=; b=Fdk2VswKU1JacGNi7EdHmGrPmB iiMgxcJ/RjIUuQJVG5XTOPxcPRGr45YzGYN2XLw24/QmJfVFrP1hr3z/pHstSWKWgIuA1mLGKMnAy OJwIJ9xeNZcC+SWOekb4XOw7M; Received: from 97-122-91-54.hlrn.qwest.net ([97.122.91.54]:33540 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lBLpC-001NCz-C7 for control@debbugs.gnu.org; Sun, 14 Feb 2021 11:08:50 -0700 Date: Sun, 14 Feb 2021 11:08:49 -0700 Message-Id: <87czx2ttce.fsf@tromey.com> To: control@debbugs.gnu.org From: Tom Tromey Subject: control message for bug #41441 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.91.54 X-Source-L: No X-Exim-ID: 1lBLpC-001NCz-C7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-91-54.hlrn.qwest.net (localhost.localdomain) [97.122.91.54]:33540 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Score: 4.4 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 41441 Content analysis details: (4.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [162.241.216.53 listed in zen.spamhaus.org] 0.1 URIBL_CSS_A Contains URL's A record listed in the Spamhaus CSS blocklist [URIs: tromey.com] 0.1 URIBL_CSS Contains an URL's NS IP listed in the Spamhaus CSS blocklist [URIs: tromey.com] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.185.148.109 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [192.185.148.109 listed in list.dnswl.org] 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 3.4 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 41441 Content analysis details: (3.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [192.185.148.109 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.185.148.109 listed in wl.mailspike.net] 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [162.241.216.53 listed in zen.spamhaus.org] 0.1 URIBL_CSS_A Contains URL's A record listed in the Spamhaus CSS blocklist [URIs: tromey.com] 0.1 URIBL_CSS Contains an URL's NS IP listed in the Spamhaus CSS blocklist [URIs: tromey.com] 0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager close 41441 From unknown Wed Aug 20 01:18:14 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 15 Mar 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator