aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2008-03-01 09:05:12 +0000
committerAlan Mackenzie2008-03-01 09:05:12 +0000
commit0ce2ec82c9ab3c6490ccf293f025567eeb283634 (patch)
tree5f2186337739069e42fcb3e87b59a7b17b1aa97a
parentc707364afc05d8cf99396c4765878ae78619dbfb (diff)
downloademacs-0ce2ec82c9ab3c6490ccf293f025567eeb283634.tar.gz
emacs-0ce2ec82c9ab3c6490ccf293f025567eeb283634.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 db71bf33408..b122b392dd5 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -829,7 +829,7 @@ Note that the style variables are always made local to the buffer."
829 ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'. 829 ;; This function is the C/C++/ObjC value of `c-before-font-lock-function'.
830 ;; 830 ;;
831 ;; This function might do invisible changes. 831 ;; This function might do invisible changes.
832 (c-save-buffer-state (limits mbeg beg end) 832 (c-save-buffer-state (limits mbeg+1 beg end)
833 ;; First calculate the region, possibly to be extended. 833 ;; First calculate the region, possibly to be extended.
834 (setq beg (min begg c-old-BOM)) 834 (setq beg (min begg c-old-BOM))
835 (goto-char endd) 835 (goto-char endd)
@@ -841,15 +841,14 @@ Note that the style variables are always made local to the buffer."
841 (c-clear-char-property-with-value beg end 'syntax-table '(1)) 841 (c-clear-char-property-with-value beg end 'syntax-table '(1))
842 842
843 (goto-char beg) 843 (goto-char beg)
844 ;; If we're inside a string/comment, go to its end. 844 (while (and (< (point) end)
845 (if (setq limits (c-literal-limits)) 845 (search-forward-regexp c-anchored-cpp-prefix end t))
846 (goto-char (cdr limits))) 846 ;; If we've found a "#" inside a string/comment, ignore it.
847 847 (if (setq limits (c-literal-limits))
848 (while (search-forward-regexp c-anchored-cpp-prefix end t) 848 (goto-char (cdr limits))
849 (when (c-beginning-of-macro) ; Guard against being in a string/comment. 849 (setq mbeg+1 (point))
850 (setq mbeg (point))
851 (c-end-of-macro) ; Do we need to go forward 1 char here? No! 850 (c-end-of-macro) ; Do we need to go forward 1 char here? No!
852 (c-neutralize-CPP-line mbeg (point)))))) ; We might still be in a comment - this is OK. 851 (c-neutralize-CPP-line mbeg+1 (point))))))
853 852
854(defun c-before-change (beg end) 853(defun c-before-change (beg end)
855 ;; Function to be put on `before-change-function'. Primarily, this calls 854 ;; Function to be put on `before-change-function'. Primarily, this calls