Mercurial > emacs
changeset 52605:50c6e94a91cb
(c-parse-state): Fixed bug that could cause errors when the state
cache contains info on parts that have been narrowed out.
(c-forward-keyword-clause): Fixed error handling. This bug could
cause interactive font locking to bail out.
(c-just-after-func-arglist-p): Handle paren-style types in Pike. Also
fixed some cases of insufficient handling of unbalanced parens.
author | Martin Stjernholm <mast@lysator.liu.se> |
---|---|
date | Wed, 24 Sep 2003 13:55:23 +0000 |
parents | cf28ad83bf76 |
children | e1373b8163ac |
files | lisp/progmodes/cc-engine.el |
diffstat | 1 files changed, 24 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/cc-engine.el Wed Sep 24 13:55:07 2003 +0000 +++ b/lisp/progmodes/cc-engine.el Wed Sep 24 13:55:23 2003 +0000 @@ -1740,10 +1740,10 @@ ;; If point-min has moved forward then we just need to cut ;; off a bit of the tail. (let ((ptr (cons nil c-state-cache)) elem) - (while (and (setq elem (cdr ptr)) + (while (and (setq elem (car-safe (cdr ptr))) (>= (if (consp elem) (car elem) elem) (point-min))) - (setq ptr elem)) + (setq ptr (cdr ptr))) (when (consp ptr) (if (eq (cdr ptr) c-state-cache) (setq c-state-cache nil) @@ -3499,8 +3499,8 @@ (setq safe-pos (point))) ((and (c-keyword-member kwd-sym 'c-nonsymbol-sexp-kwds) - (not (looking-at c-symbol-start))) - (c-forward-sexp) + (not (looking-at c-symbol-start)) + (c-safe (c-forward-sexp) t)) (c-forward-syntactic-ws) (setq safe-pos (point)))) @@ -4251,7 +4251,7 @@ (c-search-uplist-for-classkey paren-state)))) (defun c-just-after-func-arglist-p (&optional lim) - ;; Return t if we are between a function's argument list closing + ;; Return non-nil if we are between a function's argument list closing ;; paren and its opening brace. Note that the list close brace ;; could be followed by a "const" specifier or a member init hanging ;; colon. LIM is used as bound for some backward buffer searches; @@ -4299,20 +4299,25 @@ (or (not (c-beginning-of-macro)) (and (c-forward-to-cpp-define-body) (< (point) checkpoint))) - ;; check if we are looking at an ObjC method def - (or (not c-opt-method-key) - (progn - (goto-char checkpoint) - (c-forward-sexp -1) - (forward-char -1) - (c-backward-syntactic-ws lim) - (not (or (memq (char-before) '(?- ?+)) - ;; or a class category - (progn - (c-forward-sexp -2) - (looking-at c-class-key)) - ))))) - ))) + ;; Check if we are looking at an ObjC method def or a class + ;; category. + (not (and c-opt-method-key + (progn + (goto-char checkpoint) + (c-safe (c-backward-sexp) t)) + (progn + (c-backward-syntactic-ws lim) + (or (memq (char-before) '(?- ?+)) + (and (c-safe (c-forward-sexp -2) t) + (looking-at c-class-key)))))) + ;; Pike has compound types that include parens, + ;; e.g. "array(string)". Check that we aren't after one. + (not (and (c-major-mode-is 'pike-mode) + (progn + (goto-char checkpoint) + (c-safe (c-backward-sexp 2) t)) + (looking-at c-primitive-type-key))) + )))) (defun c-in-knr-argdecl (&optional lim) ;; Return the position of the first argument declaration if point is