[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to befo
From: |
Mattias Engdegård |
Subject: |
Re: emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to before-change-functions ... |
Date: |
Sun, 1 Mar 2020 12:49:39 +0100 |
28 feb. 2020 kl. 17.54 skrev Glenn Morris <address@hidden>:
>> CC Mode: Protect against consecutive calls to before-change-functions ...
>
> This causes srecode-utest-getset-output in
> test/lisp/cedet/srecode-utest-getset.el to fail:
Indeed, and so does electric-tests. Condensed reproduction:
(with-temp-buffer
(c-mode)
(insert "a")
(comment-region (point-min) (point-max)))
Alan, it looks like the code has lost control over c-new-END. c-after-change
over-adjusts it to a value beyond the buffer size.
The problem seems to go away with the expedient below but it is unlikely to be
the right solution.
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -2006,7 +2006,8 @@ c-after-change
;; (c-new-BEG c-new-END) will be the region to fontify. It may become
;; larger than (beg end).
- (setq c-new-END (- (+ c-new-END (- end beg)) old-len))
+ (setq c-new-END (min (- (+ c-new-END (- end beg)) old-len)
+ (point-max)))
(unless (c-called-from-text-property-change-p)
(setq c-just-done-before-change nil)
- Re: emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to before-change-functions ...,
Mattias Engdegård <=