emacs-devel
[Top][All Lists]
Advanced

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

Re: jit-lock refontifies too much


From: martin rudalics
Subject: Re: jit-lock refontifies too much
Date: Wed, 14 Sep 2005 07:48:57 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>>          (when font-lock-multiline
>>            (setq end (or (text-property-any end (point-max)
>>                                             'font-lock-multiline nil)
>>                          (point-max)))
>>             (goto-char end)
>>             (setq end (line-beginning-position 2)))
>>          ;; Now do the fontification.
>
>
> I'd rather change jit-lock, since font-lock may be used without jit-lock.

It would be unsafe to change jit-lock.  Currently it is not mandatory
for a "font-lock-fontify-region-function" to adjust the end of the
region.  delphi-fontify-region, for example, doesn't.  It does rely on
jit-lock-fontify-now to provide correct endpoints.  Put this the other
way round.  If font-lock-default-fontify-region's present approach to
fontify an additional line were indeed mandatory, most current
font-lock-fontify-region-functions would be invalid since they do not
adjust the end of the region.

Anyway, my first solution should emulate your proposal.  It would
suppress fontification of the second line iff jit-lock is turned on.
Using font-lock without jit-lock would not change the current behavior:

          (cond
           (font-lock-multiline
            (setq end (or (text-property-any end (point-max)
                                             'font-lock-multiline nil)
                          (point-max)))
            (goto-char end) (setq end (line-beginning-position 2)))
           ;; don't modify end in jit-lock-mode
           ((and (boundp 'jit-lock-mode) jit-lock-mode))
           (t (goto-char end) (setq end (line-beginning-position 2))))
          ;; Now do the fontification.






reply via email to

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