diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-01-31 18:54:50 -0500 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-01-31 18:54:50 -0500 |
commit | 14beddf4711854b01d400f36166dc71eb39435bb (patch) | |
tree | 04fd96bb0f5dcf5f3aa4e9f39a537edc61038f83 /lisp/progmodes | |
parent | 2a4466ca2001c29fd654420b081b780981333dc5 (diff) | |
parent | 113ef437f21c6ea1b65abe668feb86f1622a9f2e (diff) | |
download | emacs-14beddf4711854b01d400f36166dc71eb39435bb.tar.gz |
Merge changes from emacs-23 branch
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/cc-cmds.el | 33 | ||||
-rw-r--r-- | lisp/progmodes/cc-engine.el | 13 |
2 files changed, 33 insertions, 13 deletions
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 327ebea40cc..ec913e05c7e 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -2440,13 +2440,15 @@ function does not require the declaration to contain a brace block." (goto-char last) (throw 'done '(nil . nil))) - ;; Stop if we encounter a preprocessor line. - ((and (not macro-end) + ;; Stop if we encounter a preprocessor line. Continue if we + ;; hit a naked # + ((and c-opt-cpp-prefix + (not macro-end) (eq (char-after) ?#) (= (point) (c-point 'boi))) - (goto-char last) - ;(throw 'done (cons (eq (point) here) 'macro-boundary))) ; Changed 2003/3/26 - (throw 'done '(t . macro-boundary))) + (if (= (point) here) ; Not a macro, therefore naked #. + (forward-char) + (throw 'done '(t . macro-boundary)))) ;; Stop after a ';', '}', or "};" ((looking-at ";\\|};?") @@ -2560,14 +2562,21 @@ be more \"DWIM:ey\"." (c-backward-syntactic-ws)) (or (bobp) (c-after-statement-terminator-p))))))) ;; Are we about to move backwards into or out of a - ;; preprocessor command? If so, locate it's beginning. + ;; preprocessor command? If so, locate its beginning. (when (eq (cdr res) 'macro-boundary) - (save-excursion - (beginning-of-line) - (setq macro-fence - (and (not (bobp)) - (progn (c-skip-ws-backward) (c-beginning-of-macro)) - (point))))) + (setq macro-fence + (save-excursion + (if macro-fence + (progn + (end-of-line) + (and (not (eobp)) + (progn (c-skip-ws-forward) + (c-beginning-of-macro)) + (progn (c-end-of-macro) + (point)))) + (and (not (eobp)) + (c-beginning-of-macro) + (progn (c-end-of-macro) (point))))))) ;; Are we about to move backwards into a literal? (when (memq (cdr res) '(macro-boundary literal)) (setq range (c-ascertain-preceding-literal))) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 406ee1a91d9..f90d29bf009 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -5371,6 +5371,8 @@ comment at the start of cc-engine.el for more info." ;; cc-mode requires cc-fonts. (declare-function c-fontify-recorded-types-and-refs "cc-fonts" ()) +(defvar c-forward-<>-arglist-recur-depth) + (defun c-forward-<>-arglist (all-types) ;; The point is assumed to be at a "<". Try to treat it as the open ;; paren of an angle bracket arglist and move forward to the @@ -5396,7 +5398,8 @@ comment at the start of cc-engine.el for more info." ;; If `c-record-type-identifiers' is set then activate ;; recording of any found types that constitute an argument in ;; the arglist. - (c-record-found-types (if c-record-type-identifiers t))) + (c-record-found-types (if c-record-type-identifiers t)) + (c-forward-<>-arglist-recur--depth 0)) (if (catch 'angle-bracket-arglist-escape (setq c-record-found-types (c-forward-<>-arglist-recur all-types))) @@ -5413,6 +5416,14 @@ comment at the start of cc-engine.el for more info." nil))) (defun c-forward-<>-arglist-recur (all-types) + + ;; Temporary workaround for Bug#7722. + (when (boundp 'c-forward-<>-arglist-recur--depth) + (if (> c-forward-<>-arglist-recur--depth 200) + (error "Max recursion depth reached in <> arglist") + (setq c-forward-<>-arglist-recur--depth + (1+ c-forward-<>-arglist-recur--depth)))) + ;; Recursive part of `c-forward-<>-arglist'. ;; ;; This function might do hidden buffer changes. |