Mercurial > emacs
changeset 80258:54ec3d566dbb
(c-neutralize-syntax-in-CPP): Fix coding bug.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Sat, 01 Mar 2008 09:05:12 +0000 |
parents | 11e84af22e25 |
children | b30a40e18121 |
files | lisp/progmodes/cc-mode.el |
diffstat | 1 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/cc-mode.el Sat Mar 01 09:02:47 2008 +0000 +++ b/lisp/progmodes/cc-mode.el Sat Mar 01 09:05:12 2008 +0000 @@ -829,7 +829,7 @@ ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'. ;; ;; This function might do invisible changes. - (c-save-buffer-state (limits mbeg beg end) + (c-save-buffer-state (limits mbeg+1 beg end) ;; First calculate the region, possibly to be extended. (setq beg (min begg c-old-BOM)) (goto-char endd) @@ -841,15 +841,14 @@ (c-clear-char-property-with-value beg end 'syntax-table '(1)) (goto-char beg) - ;; If we're inside a string/comment, go to its end. - (if (setq limits (c-literal-limits)) - (goto-char (cdr limits))) - - (while (search-forward-regexp c-anchored-cpp-prefix end t) - (when (c-beginning-of-macro) ; Guard against being in a string/comment. - (setq mbeg (point)) + (while (and (< (point) end) + (search-forward-regexp c-anchored-cpp-prefix end t)) + ;; If we've found a "#" inside a string/comment, ignore it. + (if (setq limits (c-literal-limits)) + (goto-char (cdr limits)) + (setq mbeg+1 (point)) (c-end-of-macro) ; Do we need to go forward 1 char here? No! - (c-neutralize-CPP-line mbeg (point)))))) ; We might still be in a comment - this is OK. + (c-neutralize-CPP-line mbeg+1 (point)))))) (defun c-before-change (beg end) ;; Function to be put on `before-change-function'. Primarily, this calls