[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57804: An infinite loop in a `fontify-region' function causes Emacs
From: |
Paul Pogonyshev |
Subject: |
bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely |
Date: |
Thu, 15 Sep 2022 23:49:10 +0200 |
> It can do so (or more precisely will be able to do so) by calling
> narrowing-unlock with the appropriate tag, which IIUC correctly is, in
> your case, 'fontification-functions.
OK, let me rewrite this in a bit more details. Here are some quotes
from the C code in the branch:
safe_run_hooks_maybe_narrowed (Qpre_command_hook,
XWINDOW (selected_window));
...
safe_run_hooks_maybe_narrowed (Lisp_Object hook, struct window *w)
{
...
if (current_buffer->long_line_optimizations_p)
narrow_to_region_locked (make_fixnum (get_narrowed_begv (w, PT)),
make_fixnum (get_narrowed_zv (w, PT)),
hook);
Note how `hook' becomes `tag', i.e. narrowing is locked with tag
`pre-command-hook' _in this case_. According to the code, it can also
be locked with a few others, e.g. `post-command-hook'.
Now, user writes in his `init.el' sth. like:
(add-hook 'pre-command-hook (lambda ()
(when (eq major-mode 'logview-mode)
(logview-do-bla-bla-bla))))
I don't know why, this is a hypothetical, but fairly realistic
situation, right?
Now, let's say function `logview-do-bla-bla-bla' cannot work with
narrowed buffer (half of functions in Logview cannot). So, as a first
step it does something like this:
(save-restriction
(widen)
...
)
For this to keep working in Emacs 29, I will need to replace `(widen)'
with I-don't-yet-know-what. But _I don't know the tag_. That's the
problem. The function is called from somewhere I have no control, it
can be bound to any hook that does install locked narrowing with some
tag or maybe does not - I have no way to know that.
Will I be able to lift locked narrowing restrictions without knowing
the tag?
Paul
>
> Logview needs to temporarily cancel restrictions in _practically all_
> its function.
>
It can do so (or more precisely will be able to do so) by calling
narrowing-unlock with the appropriate tag, which IIUC correctly is, in
your case, 'fontification-functions. I don't see why you would need
anything else, especially given that a general mechanism to disable locked
narrowing everywhere is already available for users who, like you, don't
care about long lines.
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, (continued)
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Paul Pogonyshev, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Eli Zaretskii, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Paul Pogonyshev, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Eli Zaretskii, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Gregory Heytings, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Lars Ingebrigtsen, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Paul Pogonyshev, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Gregory Heytings, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Paul Pogonyshev, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Gregory Heytings, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely,
Paul Pogonyshev <=
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Gregory Heytings, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Paul Pogonyshev, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Gregory Heytings, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Eli Zaretskii, 2022/09/16
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Paul Pogonyshev, 2022/09/16
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Eli Zaretskii, 2022/09/16
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Eli Zaretskii, 2022/09/16
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Ihor Radchenko, 2022/09/15
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Eli Zaretskii, 2022/09/16
- bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely, Gregory Heytings, 2022/09/15