mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
Fix another "wrong side of point" error in CC Mode.
This fixes (a follow-up to) bug #28850. A internal generated form for scanning text to fontify had a LIMIT parameter. It also locally bound LIMIT to a value possibly beyond the original LIMIT, allowing point to move beyond the original LIMIT, and to create the wrong side error. Fix it by checking point is not beyond LIMIT in the outer context before using it. * lisp/progmodes/cc-fonts.el (c-make-font-lock-search-form): Add a new parameter CHECK-POINT which, when non-nil, directs the function to generate a check on point. (c-make-font-lock-context-search-function): Invoke the above function with new argument value t.
This commit is contained in:
parent
646e56e150
commit
ad68bbd0da
@ -292,12 +292,17 @@
|
||||
nil)))))
|
||||
res))))
|
||||
|
||||
(defun c-make-font-lock-search-form (regexp highlights)
|
||||
(defun c-make-font-lock-search-form (regexp highlights &optional check-point)
|
||||
;; Return a lisp form which will fontify every occurrence of REGEXP
|
||||
;; (a regular expression, NOT a function) between POINT and `limit'
|
||||
;; with HIGHLIGHTS, a list of highlighters as specified on page
|
||||
;; "Search-based Fontification" in the elisp manual.
|
||||
`(while (re-search-forward ,regexp limit t)
|
||||
;; "Search-based Fontification" in the elisp manual. If CHECK-POINT
|
||||
;; is non-nil, we will check (< (point) limit) in the main loop.
|
||||
`(while
|
||||
,(if check-point
|
||||
`(and (< (point) limit)
|
||||
(re-search-forward ,regexp limit t))
|
||||
`(re-search-forward ,regexp limit t))
|
||||
(unless (progn
|
||||
(goto-char (match-beginning 0))
|
||||
(c-skip-comments-and-strings limit))
|
||||
@ -476,7 +481,9 @@
|
||||
,(c-make-font-lock-search-form
|
||||
regexp highlights)))))
|
||||
state-stanzas)
|
||||
,(c-make-font-lock-search-form (car normal) (cdr normal))
|
||||
;; In the next form, check that point hasn't been moved beyond
|
||||
;; `limit' in any of the above stanzas.
|
||||
,(c-make-font-lock-search-form (car normal) (cdr normal) t)
|
||||
nil))))
|
||||
|
||||
; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
|
||||
|
Loading…
Reference in New Issue
Block a user