Subject: bug#20240: 25.0.50; CC Mode broken fontification and commenting

From: Alan Mackenzie <[email-masked]>
Date: Sat, 4 Apr 2015 10:45:39 +0000

Hello, Stefan and Mark.

On Fri, Apr 03, 2015 at 06:09:12PM -0400, Stefan Monnier wrote:
> > -          (run-hook-with-args 'jit-lock-after-change-extend-region-functions
> > -                              start end old-len)
> > -          ;; Make sure we change at least one char (in case of deletions).
> > -          (setq jit-lock-end (min (max jit-lock-end (1+ start)) (point-max)))
> > -          ;; Request refontification.
> > -          (put-text-property jit-lock-start jit-lock-end 'fontified nil))
> > +          (save-restriction
> > +           (widen)
> > +           (run-hook-with-args 'jit-lock-after-change-extend-region-functions
> > +                               start end old-len)
> > +           ;; Make sure we change at least one char (in case of deletions).
> > +           (setq jit-lock-end (min (max jit-lock-end (1+ start)) (point-max)))
> > +           ;; Request refontification.
> > +           (put-text-property jit-lock-start jit-lock-end 'fontified nil)))

> Widening during the call to
> jit-lock-after-change-extend-region-functions seems wrong.  But I guess
> there can be meaningful cases where
> jit-lock-after-change-extend-region-functions could return positions
> outside of the narrowed region, so I'd be OK with widening during the
> subsequent `put-text-property'.

Thanks.  I've just committed that change.

Mark, would you please update your Emacs and build it again, then test
whether or not your bug has finally been fixed, then let us know.  Then
I can close the bug.  Thanks!

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).