Emacs/cc-ide: Even more emacs22 fixes
[emacsstuff.git] / cc-ide / cc-engine-2.el
index 1247e55..5933977 100644 (file)
 (defun c-beginning-of-defun-or-decl ()
   (if (c-in-literal)
       (goto-char (car (c-literal-limits))))
-  (while (and (not (c-at-toplevel-p))
-             (c-save-uplist -1)))
-  (c-move-to-start-of-defun)
-  (let ((point (point))
-       (flag (c-beginning-of-statement-1))
-       beg)
-    (cond ((eq flag 'label)
-          (c-forward-label))
-         ((eq flag 'previous)
-          (goto-char point)))
+  (c-save-buffer-state ()
+    (while (and (not (c-at-toplevel-p))
+               (c-save-uplist -1)))
+    (c-move-to-start-of-defun)
+    (let ((point (point))
+         (flag (c-beginning-of-statement-1))
+         beg)
+      (cond ((eq flag 'label)
+            (c-forward-label))
+           ((eq flag 'previous)
+            (goto-char point)))
     ;(setq beg (point))
     ;(c-end-of-statement)
     ;(if (> (point) point)
        ;(goto-char beg)
       ;(goto-char point))
-    (c-forward-syntactic-ws)))
+      (c-forward-syntactic-ws))))
 
 (defun c-forward-out-of-comment ()
   (while (memq (c-in-literal) '(c c++))
       (loop for state = (c-parse-state)
             while state
             thereis (loop for substate on state
-                          thereis (c-search-uplist-for-classkey substate))
+                          thereis (c-save-buffer-state () (c-search-uplist-for-classkey substate)))
             for elt = (car (last state))
             do (goto-char (if (consp elt) (car elt) elt))))))