all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Gregory Heytings <gregory@heytings.org>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 57804@debbugs.gnu.org
Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely
Date: Thu, 15 Sep 2022 17:37:59 +0200	[thread overview]
Message-ID: <CAG7BpapV6QHHk4De3ZEdGByP1AZ0GarPfdE4vCvE1Fqa4Ydw=Q@mail.gmail.com> (raw)
In-Reply-To: <b24128855b18a6b7e0b1@heytings.org>

[-- Attachment #1: Type: text/plain, Size: 3463 bytes --]

> > or is it "you have to rewrite, because we have decided so"?
>
> That's not how I would present things, no.

It doesn't matter how you would present it, it's the result that
matters.

> Why does Logview infloop when
> locked narrowing is in effect?  This might be a bug in Logview

Because it assumes that after `widen' all restrictions are gone.  If I
do

    x = 10 + 20
    if (x == 25)
      throw new Error ();

and this results in an error, then the bug is not _in my code_.

If I need to treat every function as "pretty please, do this, but if
you don't, it's fine, I'll do something else", my code will inflate
tenfolds and will still not achieve its goals.

> fontification-functions / jit-lock-function is not supposed to access and
> modify a large portion of the buffer.

"Is not supposed" is not the same as "must not do, else everything
crashes".

> I don't use Logview, and you did
> not give a detailed recipe to reproduce the issue

Recipe is obvious:

    (widen)
    (if (/= (point-min) 1) (error "WTF is going on?"))

Why Logview needs to access the full buffer at any time? Because it
operates lazily. It expects that log files are several megabytes and
therefore doesn't parse them fully. There are at least two passes:
first splits the file into entries, second fontifies. The first can be
used for other reasons too. In other words, when fontification comes
around, the relevant buffer part may not be even split into entries
yet, so fontification code calls the splitting code first. Logview
also almost never moves the point internally (because that might be
slow in huge buffers), instead it needs to be able to query text
properties anywhere. And with narrowing this is impossible.

Frankly, I don't see why I need to tell you _why_ I need this. Even if
I write five pages explaining every single detail, all things I have
considered in the years this mode had been written (with one major
refactoring for performance reason), I know the answer: "Yeah, but you
could do X or Y instead". Of course, I have never thought about that,
yeah. Of course I have just chosen this approach randomly.

You either accept that there _might_ be something you haven't thought
about, you have never discovered or simply never needed. Or you
don't. Then you just say: "Do it this way! For me it's enough,
therefore it _must_ be enough for everyone. Or if it's not it's their
problem and I don't care.".

Paul

On Thu, 15 Sept 2022 at 17:10, Gregory Heytings <gregory@heytings.org>
wrote:

>
> >
> > Is it technically impossible to lift narrowing restrictions in Emacs 29
> >
>
> It is not, you can choose a radical approach and long-line-threshold to
> nil.  Or you can choose a less radical approach and set
> long-line-threshold to a larger value (as I already told you twice IIRC).
>
> >
> > (as in, something would break),
> >
>
> Locked narrowing is one part of the solution to the long lines bug in
> Emacs, so something could indeed break if you turn that solution off.
>
> >
> > or is it "you have to rewrite, because we have decided so"?
> >
>
> That's not how I would present things, no.  Why does Logview infloop when
> locked narrowing is in effect?  This might be a bug in Logview:
> fontification-functions / jit-lock-function is not supposed to access and
> modify a large portion of the buffer.  I don't use Logview, and you did
> not give a detailed recipe to reproduce the issue, so it's difficult to
> give more precise advice.
>

[-- Attachment #2: Type: text/html, Size: 4252 bytes --]

  reply	other threads:[~2022-09-15 15:37 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 15:05 bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely Paul Pogonyshev
2022-09-14 16:00 ` dick
2022-09-14 16:06   ` Paul Pogonyshev
2022-09-14 16:14 ` dick
2022-09-14 17:52   ` Lars Ingebrigtsen
2022-09-14 18:18     ` Eli Zaretskii
2022-09-14 16:41 ` Lars Ingebrigtsen
2022-09-14 16:57   ` Paul Pogonyshev
2022-09-14 17:25     ` Lars Ingebrigtsen
2022-09-14 17:30       ` Paul Pogonyshev
2022-09-14 17:43       ` Eli Zaretskii
2022-09-14 17:45         ` Lars Ingebrigtsen
2022-09-14 17:49           ` Eli Zaretskii
2022-09-15  2:17             ` Ihor Radchenko
2022-09-14 17:34     ` Gregory Heytings
2022-09-15 14:47       ` Paul Pogonyshev
2022-09-15 15:10         ` Gregory Heytings
2022-09-15 15:37           ` Paul Pogonyshev [this message]
2022-09-15 16:08             ` Gregory Heytings
2022-09-15 16:19               ` Paul Pogonyshev
2022-09-15 16:44                 ` Gregory Heytings
2022-09-15 18:49                   ` Paul Pogonyshev
2022-09-15 19:16                     ` Eli Zaretskii
2022-09-15 19:36                       ` Paul Pogonyshev
2022-09-15 19:45                         ` Eli Zaretskii
2022-09-15 20:18                         ` Gregory Heytings
2022-09-15 20:22                           ` Lars Ingebrigtsen
2022-09-15 20:40                           ` Paul Pogonyshev
2022-09-15 20:44                             ` Gregory Heytings
2022-09-15 21:17                               ` Paul Pogonyshev
2022-09-15 21:32                                 ` Gregory Heytings
2022-09-15 21:49                                   ` Paul Pogonyshev
2022-09-15 22:16                                     ` Gregory Heytings
2022-09-15 22:53                                       ` Paul Pogonyshev
2022-09-15 23:13                                         ` Gregory Heytings
2022-09-16  6:40                                         ` Eli Zaretskii
2022-09-16 10:08                                           ` Paul Pogonyshev
2022-09-16 10:44                                             ` Eli Zaretskii
2022-09-16  6:31                             ` Eli Zaretskii
     [not found]                               ` <1260fd38-d4b3-5ca1-5b15-78f59c0255b6@yandex.ru>
     [not found]                                 ` <83o7t9k8fr.fsf@gnu.org>
     [not found]                                   ` <CAG7Bpaow570a8Qrq6VxU+=MNF55UmnCMFFXT2Eg=vQUTgrxeoQ@mail.gmail.com>
     [not found]                                     ` <34e17bf2a6bdd269fba7@heytings.org>
     [not found]                                       ` <CAG7BpapFE0HEwi8iUoStz9EyAwH-QdZ_CxOUNtdUeKDmzCrZaQ@mail.gmail.com>
     [not found]                                         ` <338f50d421074805735f@heytings.org>
     [not found]                                           ` <831qpnngeg.fsf@gnu.org>
     [not found]                                             ` <338f50d421b672315145@heytings.org>
2022-11-28 18:32                                               ` Eli Zaretskii
2022-09-16  1:17                           ` Ihor Radchenko
2022-09-16  5:35                           ` Eli Zaretskii
2022-09-15 19:44                     ` Gregory Heytings
2022-09-15 20:07                       ` Paul Pogonyshev
2022-09-15 20:26                         ` Gregory Heytings
2022-09-16  5:37                           ` Eli Zaretskii
2022-09-15 22:20                       ` dick
2022-09-15 22:38                         ` Gregory Heytings
2022-09-16  6:19                         ` Eli Zaretskii
2022-09-16  7:44                         ` Gerd Möllmann
2022-09-14 17:02 ` Eli Zaretskii
2022-09-14 17:25   ` Paul Pogonyshev
2022-09-14 17:32     ` Eli Zaretskii
2022-09-14 17:38   ` Lars Ingebrigtsen
2022-09-14 17:44     ` Eli Zaretskii
2022-09-14 17:46       ` Lars Ingebrigtsen
2022-09-14 17:51         ` Eli Zaretskii
2022-09-15  5:20     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-15  6:27       ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG7BpapV6QHHk4De3ZEdGByP1AZ0GarPfdE4vCvE1Fqa4Ydw=Q@mail.gmail.com' \
    --to=pogonyshev@gmail.com \
    --cc=57804@debbugs.gnu.org \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.