diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index c4fabf30235..fe93bc759b2 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -6992,6 +6992,18 @@ the_larch, @hereFn{c-lineup-topmost-intro-cont} @workswith @code{topmost-intro-cont}. @end defun +@comment ------------------------------------------------------------ + +@defun c-lineup-class-field-cont +@findex lineup-class-field-cont (c-) +Indent continutation lines zero or one @code{c-basic-offset} steps. +This is intended for continuation lines within a class/struct +etc. construct. For a declaration following a template specification, +zero steps are used. Other constructs are indented one step. + +@workswith @code{class-field-cont}. +@end defun + @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @node Custom Line-Up @section Custom Line-Up Functions diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index a293fd858b7..5766c87388f 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el @@ -97,6 +97,16 @@ Works with: topmost-intro-cont." t)))) c-basic-offset)))) +(defun c-lineup-class-field-cont (langelem) + "Line up continuation lines in a class zero or one indentation steps. +For a declaration following a template specification, zero steps are +used. Other constructs are indented one step." + (save-excursion + (beginning-of-line) + (c-backward-syntactic-ws (c-langelem-pos langelem)) + (unless (eq (char-before) ?>) + c-basic-offset))) + (defun c-lineup-gnu-DEFUN-intro-cont (langelem) "Line up the continuation lines of a DEFUN macro in the Emacs C source. These lines are indented `c-basic-offset' columns, usually from column 0. diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 4df6017bc56..bb7f3cbe257 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el @@ -1302,7 +1302,7 @@ can always override the use of `c-default-style' by making calls to ;; Anchor pos: Boi at the func decl arglist open. (member-init-cont . c-lineup-multi-inher) ;; Anchor pos: Beg of the first member init. - (class-field-cont . +) + (class-field-cont . c-lineup-class-field-cont) ;; Anchor pos: BOI of the line containing the class keyword. ;; 2nd pos: At the open brace. (inher-intro . +)