[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61215: 29.0.60; font-lock broken in diff-mode with long lines
From: |
Eli Zaretskii |
Subject: |
bug#61215: 29.0.60; font-lock broken in diff-mode with long lines |
Date: |
Mon, 06 Feb 2023 20:10:24 +0200 |
> From: Juri Linkov <juri@linkov.net>
> Cc: 61215@debbugs.gnu.org
> Date: Mon, 06 Feb 2023 19:15:49 +0200
>
> >> If you think the problem is in diff-syntax-fontify-hunk,
> >> then I could try to find a working workaround local to diff-mode.
> >
> > Yes, now this is something for diff-mode to solve: it shouldn't assume
> > that it will always be able to go to the beginning and the end of a
> > hunk, because narrowing could interfere with that. Diff-mode should
> > have some fallback plan for these cases.
>
> After debugging I discovered that the problem is not caused by font-lock
> in diff-mode. The problem is in easy-mmode-define-navigation.
> diff-mode uses it to navigate diff hunks. It supports such a feature
> that when the user narrowed the diff buffer, it puts narrowing back
> after moving to the next hunk. But this fails when the diff buffer
> is narrowed automatically by long-line-optimizations. If there is
> no way to distinguish whether the narrowing is automatic by long-lines
> or manual by the user, this patch fixes the problem. It works without
> errors, and even highlights first 250000 characters of the long line:
Thanks.
Maybe Gregory (CC'ed) can help here and tell whether there's a better
solution.
> diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
> index 5721470ad0d..d9176061434 100644
> --- a/lisp/emacs-lisp/easy-mmode.el
> +++ b/lisp/emacs-lisp/easy-mmode.el
> @@ -782,7 +782,10 @@ easy-mmode-define-navigation
> (when-narrowed
> (lambda (body)
> (if (null narrowfun) body
> - `(let ((was-narrowed (prog1 (buffer-narrowed-p) (widen))))
> + `(let ((was-narrowed
> + (prog1 (unless (long-line-optimizations-p)
> + (buffer-narrowed-p))
> + (widen))))
> ,body
> (when was-narrowed (funcall #',narrowfun)))))))
> (unless name (setq name base-name))
>
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Juri Linkov, 2023/02/01
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Eli Zaretskii, 2023/02/01
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Juri Linkov, 2023/02/02
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Eli Zaretskii, 2023/02/02
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Juri Linkov, 2023/02/03
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Eli Zaretskii, 2023/02/03
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Juri Linkov, 2023/02/05
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Eli Zaretskii, 2023/02/05
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Juri Linkov, 2023/02/06
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines,
Eli Zaretskii <=
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Gregory Heytings, 2023/02/06
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Juri Linkov, 2023/02/27
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Eli Zaretskii, 2023/02/27
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Gregory Heytings, 2023/02/27
- bug#61215: 29.0.60; font-lock broken in diff-mode with long lines, Gregory Heytings, 2023/02/27