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: Dmitry Gutov
Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049.
Date: Thu, 14 Nov 2019 16:05:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 14.11.2019 15:42, Stefan Monnier wrote:
  ;; Return number of screen lines between START and END.
  (defun repos-count-screen-lines (start end)
+  ;; Make sure jit-lock doesn't have to run in a narrowed context.
+  (font-lock-ensure start end)
    (save-excursion
      (save-restriction
        (narrow-to-region start end)

Hmm... the buffer might have font-lock disabled, in which case we'd
be fontifying where the user didn't want fontification.

We could wrap it in (when font-lock-mode ...), then? Or something to that effect.

But I haven't followed the thread enough to know what we're talking
about, really.  E.g. I have no idea what's the connection between
CC-mode, font-lock-dont-widen, and the above hunk.  More specifically,
when looking at the above patch my first reaction is "if it's needed
here, why isn't it needed almost everywhere else as well?"

The hope is that calling vertical-motion (or font-lock-ensure directly) inside narrowing is a rare occasion, and it doesn't happen in a lot of functions. At least that has been my experience.



reply via email to

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