CC Mode: Don't indent a construct in a class after a template
This fixes bug#79438. * lisp/progmodes/cc-align.el (c-lineup-class-field-cont): New function. * lisp/progmodes/cc-vars.el (c-offsets-alist): Change the entry for class-field-cont from + to c-lineup-class-field-cont. * doc/misc/cc-mode.texi (Misc Line-Up): Add a new entry for c-lineup-class-field-cont.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 . +)
|
||||
|
||||
Reference in New Issue
Block a user