[Top][All Lists]

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

Re: scratch/tzz/prettify-text-mode f8b4f20 1/3: lisp/progmodes/prog-mode

From: Ted Zlatanov
Subject: Re: scratch/tzz/prettify-text-mode f8b4f20 1/3: lisp/progmodes/prog-mode.el: prevent font-lock-flush boundary errors
Date: Sun, 23 Aug 2020 18:36:03 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Sun, 12 Jul 2020 17:32:49 -0400 Stefan Monnier <monnier@iro.umontreal.ca> 

>> --- a/lisp/progmodes/prog-mode.el
>> +++ b/lisp/progmodes/prog-mode.el
>> @@ -183,6 +183,11 @@ on the symbol."
>> (> (point) (cadr prettify-symbols--current-symbol-bounds))
>> (and (not (eq prettify-symbols-unprettify-at-point 'right-edge))
>> (= (point) (cadr prettify-symbols--current-symbol-bounds)))))
>> +      ;; Adjust the bounds in case either end is invalid.
>> +      (setf (car prettify-symbols--current-symbol-bounds)
>> +            (max (car prettify-symbols--current-symbol-bounds) (point-min))
>> +            (cadr prettify-symbols--current-symbol-bounds)
>> +            (min (cadr prettify-symbols--current-symbol-bounds) 
>> (point-max)))

SM> Could you add in the comment some explanation for why this is needed
SM> (e.g. a known case where this happens)?

It happened for me at the end of the buffer with multi-character
coverups, when I deleted backwards. It was simply that the cached end
point was beyond the end of the buffer, hence the fix. I'm not sure how
to phrase the comment better to reflect that?

SM> Even better if we can fix the origin of the problem rather than
SM> workaround it here (depending on the origin of the problem, it might be
SM> inconvenient/costly to fix it, tho, so maybe this workaround is the
SM> best option).

I agree, but would not feel confident to provide an adequate in-depth
fix for this.


reply via email to

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