Function: c-lineup-class-decl-init-+
c-lineup-class-decl-init-+ is a byte-compiled function defined in
cc-align.el.gz.
Signature
(c-lineup-class-decl-init-+ LANGELEM)
Documentation
Line up the second entry of a class (etc.) initializer c-basic-offset
characters in from the identifier when:
(i) The type is a class, struct, union, etc. (but not an enum);
(ii) There is a brace block in the type declaration, specifying it; and
(iii) The first element of the initializer is on the same line as its opening
brace.
I.e. we have a construct like this:
struct STR {
int i; float f;
} str_1 = {1, 1.7},
str_2 = {2,
3.1 <---- brace-list-intro
};
<--> <---- c-basic-offset
Note that the syntactic context of the brace-list-intro line also has a syntactic element with the symbol brace-list-entry.
This function is intended for use in a list. If the above structure isn't present, this function returns nil, allowing a different offset specification to indent the line.
Works with: brace-list-intro.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cc-align.el.gz
(defun c-lineup-class-decl-init-+ (_langelem)
"Line up the second entry of a class (etc.) initializer c-basic-offset
characters in from the identifier when:
\(i) The type is a class, struct, union, etc. (but not an enum);
\(ii) There is a brace block in the type declaration, specifying it; and
\(iii) The first element of the initializer is on the same line as its opening
brace.
I.e. we have a construct like this:
struct STR {
int i; float f;
} str_1 = {1, 1.7},
str_2 = {2,
3.1 <---- brace-list-intro
};
<--> <---- c-basic-offset
Note that the syntactic context of the brace-list-intro line also has a
syntactic element with the symbol brace-list-entry.
This function is intended for use in a list. If the above structure isn't
present, this function returns nil, allowing a different offset specification
to indent the line.
Works with: brace-list-intro."
(and (assq 'brace-list-intro c-syntactic-context)
(assq 'brace-list-entry c-syntactic-context)
(let ((init-pos (c-point 'boi (c-langelem-pos
(assq 'brace-list-entry
c-syntactic-context))))
)
(save-excursion
(goto-char (c-langelem-pos (assq 'brace-list-intro
c-syntactic-context)))
(and
(c-forward-class-decl)
(not (c-do-declarators init-pos t nil nil nil))
(eq (point) init-pos)
(vector (+ (current-column) c-basic-offset)))))))