diff options
| author | Richard M. Stallman <rms@gnu.org> | 1995-10-19 22:04:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman <rms@gnu.org> | 1995-10-19 22:04:18 +0000 |
| commit | 0d48fc0afc0ec1016b678cd6ad63927727751eb8 (patch) | |
| tree | db9c2ef3715b5044b14d32e804f2cecdf2bd63c1 /lisp/progmodes/cplus-md.el | |
| parent | cf693838bdad1a9979af16e4557441928ce9253d (diff) | |
| download | emacs-0d48fc0afc0ec1016b678cd6ad63927727751eb8.tar.gz | |
(calculate-c++-indent): Skip over paren-group
when looking back to determine context of a top-level line.
Don't treat a line starting with } as a continuation.
Diffstat (limited to 'lisp/progmodes/cplus-md.el')
| -rw-r--r-- | lisp/progmodes/cplus-md.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/progmodes/cplus-md.el b/lisp/progmodes/cplus-md.el index e02a8068d1d..14f85d2205a 100644 --- a/lisp/progmodes/cplus-md.el +++ b/lisp/progmodes/cplus-md.el @@ -563,6 +563,8 @@ Returns nil if line starts inside a string, t if in a comment." (backward-char 1)) (if (= (preceding-char) ?}) 0 + (if (= (preceding-char) ?\)) + (forward-list -1)) (beginning-of-line) ; continued arg decls or member inits (skip-chars-forward " \t") (if (= (following-char) ?:) @@ -608,7 +610,14 @@ Returns nil if line starts inside a string, t if in a comment." ;; Statement. Find previous non-comment character. (goto-char indent-point) (c++-backward-to-noncomment containing-sexp) - (if (not (memq (preceding-char) '(nil ?\, ?\; ?} ?: ?\{))) + (if (and (not (memq (preceding-char) '(0 ?\, ?\; ?\} ?\{))) + ;; But don't treat a line with a close-brace + ;; as a continuation. It is probably the + ;; end of an enum type declaration. + (save-excursion + (goto-char indent-point) + (skip-chars-forward " \t") + (not (= (following-char) ?})))) ;; This line is continuation of preceding line's statement; ;; indent c-continued-statement-offset more than the ;; previous line of the statement. |
