diff options
| author | Alan Mackenzie | 2019-04-30 13:20:22 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2019-04-30 13:20:22 +0000 |
| commit | 28853721681436a4e0adecce1df428feec4f3211 (patch) | |
| tree | 8efc742e4ecdc5e50a42bc90599f1190b7476d3a | |
| parent | c61bbb4c8e7e2f2068c1cfac9a001806a1969202 (diff) | |
| download | emacs-28853721681436a4e0adecce1df428feec4f3211.tar.gz emacs-28853721681436a4e0adecce1df428feec4f3211.zip | |
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.
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 6 |
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." | |||
| 1549 | ;; font-lock-keyword-face. It always returns NIL to inhibit this and | 1549 | ;; font-lock-keyword-face. It always returns NIL to inhibit this and |
| 1550 | ;; prevent a repeat invocation. See elisp/lispref page "Search-based | 1550 | ;; prevent a repeat invocation. See elisp/lispref page "Search-based |
| 1551 | ;; Fontification". | 1551 | ;; Fontification". |
| 1552 | (while (search-forward-regexp c-enum-clause-introduction-re limit t) | 1552 | (while (and (< (point) limit) |
| 1553 | (search-forward-regexp c-enum-clause-introduction-re limit t)) | ||
| 1553 | (when (save-excursion | 1554 | (when (save-excursion |
| 1554 | (backward-char) | 1555 | (backward-char) |
| 1555 | (c-backward-over-enum-header)) | 1556 | (c-backward-over-enum-header)) |
| @@ -2850,7 +2851,8 @@ need for `pike-font-lock-extra-types'.") | |||
| 2850 | "\\)\\)\\s *\\)@[A-Za-z_-]+\\(\\s \\|$\\)")) | 2851 | "\\)\\)\\s *\\)@[A-Za-z_-]+\\(\\s \\|$\\)")) |
| 2851 | (markup-faces (list c-doc-markup-face-name c-doc-face-name))) | 2852 | (markup-faces (list c-doc-markup-face-name c-doc-face-name))) |
| 2852 | 2853 | ||
| 2853 | (while (re-search-forward line-re limit t) | 2854 | (while (and (< (point) limit) |
| 2855 | (re-search-forward line-re limit t)) | ||
| 2854 | (goto-char (match-end 1)) | 2856 | (goto-char (match-end 1)) |
| 2855 | 2857 | ||
| 2856 | (if (looking-at autodoc-decl-keywords) | 2858 | (if (looking-at autodoc-decl-keywords) |