summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-fonts.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-04-30 13:20:22 +0000
committerAlan Mackenzie <acm@muc.de>2019-04-30 13:20:22 +0000
commit28853721681436a4e0adecce1df428feec4f3211 (patch)
tree8efc742e4ecdc5e50a42bc90599f1190b7476d3a /lisp/progmodes/cc-fonts.el
parentc61bbb4c8e7e2f2068c1cfac9a001806a1969202 (diff)
downloademacs-28853721681436a4e0adecce1df428feec4f3211.tar.gz
CC Mode: in certain font lock loops, check point is not beyond limit.
* /lisp/progmodes/cc-fonts.el (c-font-lock-enum-body) (autodoc-font-lock-line-markup): As part of the `while' condition, check that the previous iteration of the loop hasn't moved point past `limit', thus obviating "wrong side of point" errors in re-search-forward, etc.
Diffstat (limited to 'lisp/progmodes/cc-fonts.el')
-rw-r--r--lisp/progmodes/cc-fonts.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 831fa308866..c7c9aa5564e 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1549,7 +1549,8 @@ casts and declarations are fontified. Used on level 2 and higher."
;; font-lock-keyword-face. It always returns NIL to inhibit this and
;; prevent a repeat invocation. See elisp/lispref page "Search-based
;; Fontification".
- (while (search-forward-regexp c-enum-clause-introduction-re limit t)
+ (while (and (< (point) limit)
+ (search-forward-regexp c-enum-clause-introduction-re limit t))
(when (save-excursion
(backward-char)
(c-backward-over-enum-header))
@@ -2850,7 +2851,8 @@ need for `pike-font-lock-extra-types'.")
"\\)\\)\\s *\\)@[A-Za-z_-]+\\(\\s \\|$\\)"))
(markup-faces (list c-doc-markup-face-name c-doc-face-name)))
- (while (re-search-forward line-re limit t)
+ (while (and (< (point) limit)
+ (re-search-forward line-re limit t))
(goto-char (match-end 1))
(if (looking-at autodoc-decl-keywords)