changeset 67626:1e6560c0f57a

(c-after-change-check-<>-operators): After-change-functions should not clobber the match data.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 16 Dec 2005 20:07:40 +0000
parents 915691b6504f
children f571d4e1f9d5
files lisp/progmodes/cc-engine.el
diffstat 1 files changed, 23 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/cc-engine.el	Fri Dec 16 19:10:49 2005 +0000
+++ b/lisp/progmodes/cc-engine.el	Fri Dec 16 20:07:40 2005 +0000
@@ -3993,35 +3993,36 @@
   ;;
   ;; This function might do hidden buffer changes.
 
-  (save-excursion
-    (goto-char beg)
-    (when (or (looking-at "[<>]")
-	      (< (skip-chars-backward "<>") 0))
-
+  (save-match-data
+    (save-excursion
       (goto-char beg)
-      (c-beginning-of-current-token)
-      (when (and (< (point) beg)
-		 (looking-at c-<>-multichar-token-regexp)
-		 (< beg (setq beg (match-end 0))))
-	(while (progn (skip-chars-forward "^<>" beg)
-		      (< (point) beg))
-	  (c-clear-char-property (point) 'syntax-table)
-	  (forward-char))))
-
-    (when (< beg end)
-      (goto-char end)
       (when (or (looking-at "[<>]")
 		(< (skip-chars-backward "<>") 0))
 
-	(goto-char end)
+	(goto-char beg)
 	(c-beginning-of-current-token)
-	(when (and (< (point) end)
+	(when (and (< (point) beg)
 		   (looking-at c-<>-multichar-token-regexp)
-		   (< end (setq end (match-end 0))))
-	  (while (progn (skip-chars-forward "^<>" end)
-			(< (point) end))
+		   (< beg (setq beg (match-end 0))))
+	  (while (progn (skip-chars-forward "^<>" beg)
+			(< (point) beg))
 	    (c-clear-char-property (point) 'syntax-table)
-	    (forward-char)))))))
+	    (forward-char))))
+
+      (when (< beg end)
+	(goto-char end)
+	(when (or (looking-at "[<>]")
+		  (< (skip-chars-backward "<>") 0))
+
+	  (goto-char end)
+	  (c-beginning-of-current-token)
+	  (when (and (< (point) end)
+		     (looking-at c-<>-multichar-token-regexp)
+		     (< end (setq end (match-end 0))))
+	    (while (progn (skip-chars-forward "^<>" end)
+			  (< (point) end))
+	      (c-clear-char-property (point) 'syntax-table)
+	      (forward-char))))))))
 
 ;; Dynamically bound variable that instructs `c-forward-type' to also
 ;; treat possible types (i.e. those that it normally returns 'maybe or