emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes


From: Stefan Monnier
Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049.
Date: Thu, 14 Nov 2019 09:55:58 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> diff --git a/lisp/reposition.el b/lisp/reposition.el
> index 22f9986efb..5d9c3180ad 100644
> --- a/lisp/reposition.el
> +++ b/lisp/reposition.el
> @@ -174,8 +174,8 @@ reposition-window
>  (defun repos-count-screen-lines (start end)
>    (save-excursion
>      (save-restriction
> -      (narrow-to-region start end)
> -      (goto-char (point-min))
> +      (narrow-to-region (point-min) end)
> +      (goto-char start)
>        (vertical-motion (- (point-max) (point-min))))))

This looks like a good change in any case, tho it does beg the question:
why does it narrow?

Also, I think I'm beginning to understand: the issue is that
vertical-motion uses the redisplay code, which in turn calls jit-lock
when needed.  So, your earlier patch which added a call to
`font-lock-ensure` was "more or less right", except that it should have
used `jit-lock-ensure` (currently called `jit-lock-fontify-now`) and
could have a comment explaining that vertical-motion will trigger
jit-lock anyway so it's better to do it once beforehand on the whole
region, not only so it can be done outside of the narrowing but also so
it can be done more efficiently than one jit-lock-chunk-size at a time.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]