;; the function's arglist. Otherwise return nil, leaving point unchanged.
;; LIMIT, if non-nil, is a limit for the backward search.
(save-restriction
- (if limit (narrow-to-region limit (point)))
(let ((here (point))
- (paren-state (c-parse-state))
+ (paren-state (c-parse-state)) ; Do this outside the narrowing for
+ ; performance reasons.
pos level-plausible at-top-level res)
+ (if limit (narrow-to-region limit (point)))
;; Assume tentatively that we're at the top level. Try to go back to the
;; colon we seek.
(setq res
(while (and (not (and level-plausible
(setq at-top-level (c-at-toplevel-p))))
- (setq pos (c-pull-open-brace paren-state))) ; might be a paren.
+ (setq pos (c-pull-open-brace paren-state)) ; might be a paren.
+ (or (null limit) (>= pos limit)))
(setq level-plausible
(catch 'level
(goto-char pos)
((save-excursion
(goto-char match-pos)
(and (memq (char-before match-pos) '(?\( ?\,))
- (c-go-up-list-backward match-pos (c-determine-limit 500))
+ (c-go-up-list-backward match-pos
+ ; c-determine-limit is too slow, here.
+ (max (- (point) 2000) (point-min)))
(eq (char-after) ?\()
(let ((type (c-get-char-property (point) 'c-type)))
(or (memq type '(c-decl-arg-start c-decl-type-start))
c-recognize-knr-p) ; Strictly speaking, bogus, but it
; speeds up lisp.h tremendously.
(save-excursion
- (when (not (c-back-over-member-initializers (c-determine-limit 2000)))
+ (when (not (c-back-over-member-initializers
+ (max (- (point) 2000) (point-min)))) ; c-determine-limit
+ ; is too slow, here.
(unless (or (eobp)
(looking-at "\\s(\\|\\s)"))
(forward-char))