From: Alan Mackenzie Date: Mon, 13 Feb 2012 17:18:07 +0000 (+0000) Subject: Fix a loop in c-set-fl-decl-start. X-Git-Tag: emacs-pretest-24.0.94~152 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c14fcc95713913de0fa9d84e3ed502bcb0b07c38;p=emacs.git Fix a loop in c-set-fl-decl-start. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9669fbe70d0..b3381e95160 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2012-02-13 Alan Mackenzie + + Fix a loop in c-set-fl-decl-start. + + * progmodes/cc-engine (c-set-fl-decl-start): Add a check that + c-backward-syntactic-ws actually moves backwards. + 2012-02-13 Leo Liu * net/rcirc.el (rcirc-markup-attributes): Move point to the diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 374c9b434d1..2eb00e72a76 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1114,7 +1114,7 @@ Note that the style variables are always made local to the buffer." (goto-char (c-point 'bol new-pos)) (when lit-limits ; Comment or string. (goto-char (car lit-limits))) - (setq bod-lim (max (- (point) 500) (point-min))) + (setq bod-lim (c-determine-limit 500)) (while ;; Go to a less nested declaration each time round this loop. @@ -1132,11 +1132,12 @@ Note that the style variables are always made local to the buffer." ;; Try and go out a level to search again. (progn (c-backward-syntactic-ws bod-lim) - (or (memq (char-before) '(?\( ?\[)) - (and (eq (char-before) ?\<) - (eq (c-get-char-property - (1- (point)) 'syntax-table) - c-<-as-paren-syntax)))) + (and (> (point) bod-lim) + (or (memq (char-before) '(?\( ?\[)) + (and (eq (char-before) ?\<) + (eq (c-get-char-property + (1- (point)) 'syntax-table) + c-<-as-paren-syntax))))) (not (bobp))) (backward-char)) new-pos)) ; back over (, [, <.