aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2008-03-04 22:15:39 +0000
committerAlan Mackenzie2008-03-04 22:15:39 +0000
commitf18ea992ca0448a00e9744b979896484780830c1 (patch)
tree20aad2a625e8cbd269db461666c57eae8de99809
parent212906e24a9d728b0c90fc7beac9772b56d8763a (diff)
downloademacs-f18ea992ca0448a00e9744b979896484780830c1.tar.gz
emacs-f18ea992ca0448a00e9744b979896484780830c1.zip
(c-neutralize-syntax-in-CPP): Fix coding bug.
-rw-r--r--lisp/progmodes/cc-mode.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 2d8e66ab3fc..938b7caeb30 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -832,7 +832,7 @@ Note that the style variables are always made local to the buffer."
832 ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'. 832 ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'.
833 ;; 833 ;;
834 ;; This function might do invisible changes. 834 ;; This function might do invisible changes.
835 (c-save-buffer-state (limits mbeg beg end) 835 (c-save-buffer-state (limits mbeg+1 beg end)
836 ;; First calculate the region, possibly to be extended. 836 ;; First calculate the region, possibly to be extended.
837 (setq beg (min begg c-old-BOM)) 837 (setq beg (min begg c-old-BOM))
838 (goto-char endd) 838 (goto-char endd)
@@ -844,15 +844,14 @@ Note that the style variables are always made local to the buffer."
844 (c-clear-char-property-with-value beg end 'syntax-table '(1)) 844 (c-clear-char-property-with-value beg end 'syntax-table '(1))
845 845
846 (goto-char beg) 846 (goto-char beg)
847 ;; If we're inside a string/comment, go to its end. 847 (while (and (< (point) end)
848 (if (setq limits (c-literal-limits)) 848 (search-forward-regexp c-anchored-cpp-prefix end t))
849 (goto-char (cdr limits))) 849 ;; If we've found a "#" inside a string/comment, ignore it.
850 850 (if (setq limits (c-literal-limits))
851 (while (search-forward-regexp c-anchored-cpp-prefix end t) 851 (goto-char (cdr limits))
852 (when (c-beginning-of-macro) ; Guard against being in a string/comment. 852 (setq mbeg+1 (point))
853 (setq mbeg (point))
854 (c-end-of-macro) ; Do we need to go forward 1 char here? No! 853 (c-end-of-macro) ; Do we need to go forward 1 char here? No!
855 (c-neutralize-CPP-line mbeg (point)))))) ; We might still be in a comment - this is OK. 854 (c-neutralize-CPP-line mbeg+1 (point))))))
856 855
857(defun c-before-change (beg end) 856(defun c-before-change (beg end)
858 ;; Function to be put on `before-change-function'. Primarily, this calls 857 ;; Function to be put on `before-change-function'. Primarily, this calls