(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))))))
(save-excursion
(back-to-indentation)
(let ((lit (c-in-literal)))
- (if (cond ((eq lit 'c)
- (goto-char (car (c-literal-limits)))
- (looking-at "/\\*\\*<?[ \t\n\r@]"))
- ((eq lit 'c++)
- (goto-char (car (c-literal-limits)))
- (looking-at "///<?[ \t\n\r@]"))
- (t nil))
- (progn
- (goto-char (match-end 0))
- (current-column))))))
+ (when (and (memq lit '(c c++))
+ (progn (goto-char (car (c-literal-limits)))
+ (looking-at "/\\(\\*\\*\\|///\\)<?[ \t\n\r@]")))
+ (goto-char (match-end 0))
+ (current-column)))))
(defun ccide-shell-command (command)
(let ((obuf (get-buffer-create "*ccide shell command*"))
(if (eq (char-syntax (aref name (1- (length name)))) ?w) "\\>" "")))
fallback rv check-state)
(while (and (not rv) (re-search-forward re nil t))
- (if (and (c-at-toplevel-p)
- (not (c-in-literal))
- (setq check-state (condition-case nil (c-get-defun-state) (error nil)))
- (not (= (car (aref check-state 2)) skip-def)))
+ (if (c-save-buffer-state ()
+ (and (c-at-toplevel-p)
+ (not (c-in-literal))
+ (setq check-state (condition-case nil (c-get-defun-state) (error nil)))
+ (not (= (car (aref check-state 2)) skip-def))))
(if (string= scoped-name (c-defun-full-name check-state))
(if (and (if with-body (aref check-state 6) (not (aref check-state 6)))
(string= args (ccide-implementation-args check-state))