Subject: bug#20963: C++ mode indentation of initializers

From: Oliver Fernandes <[email-masked]>
Date: Thu, 2 Jul 2015 12:03:05 +0000

From: Oliver Fernandes <[email-masked]>
To: [email-masked]
Subject: 24.3; C++ mode indentation of initializers
Date: Thu, 02 Jul 2015 13:56:14 +0200
Message-ID: <[email-masked]>
--text follows this line--
####################################################
I get wrong indentation behavior for C++ mode.
The following snippet produces this behavior:
----------------------------------------------------
This happens:
SomeBase::SomeDerived::SomeFunction(const std::vector< int >& in_somevector,
                                    const std::vector< int >& in_someothervector,
                                    const glm::vec3 in_aglmvector,
                                    const glm::vec3 in_someotherglmvector,
                                    const int in_someint,
                                    const int in_someotherint,
                                    const float in_somefloat,
                                    std::vector< int >& in_someints)
: somevector(in_somevector)
                                                         , someint(in_someint) {
}
----------------------------------------------------
This is expected:
SomeBase::SomeDerived::SomeFunction(const std::vector< int >& in_somevector,
                                    const std::vector< int >& in_someothervector,
                                    const glm::vec3 in_aglmvector,
                                    const glm::vec3 in_someotherglmvector,
                                    const int in_someint,
                                    const int in_someotherint,
                                    const float in_somefloat,
                                    std::vector< int >& in_someints)
  : somevector(in_somevector)
  , someint(in_someint) {
}
----------------------------------------------------
The failed indentation seems to be related to the length of the
function header, though I did not do extensive testing.
The bug could be reproduced on at least 1 other machine.
I know this probably has low priority, but it's driving me insane, hope
it can be fixed easily :)

Thanks for a great piece of software!
####################################################

In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-07 on lamiak, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description:    Ubuntu 14.04.2 LTS

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_MONETARY: en_US.UTF-8
  value of $LC_NUMERIC: en_US.UTF-8
  value of $LC_TIME: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: C++/l

Minor modes in effect:
  workgroups-mode: t
  global-ede-mode: t
  ede-minor-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-idle-scheduler-mode: t
  semantic-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Recent input:
<end> <down> <down> <tab> <left> <backspace> <backspace>
<backspace> <backspace> s o m e f l o a t <tab> <tab>
<down> <tab> <down> <tab> <down> <tab> <down> <tab>
<up> <tab> <up> <tab> <up> <up> <down> <end> <up> <up>
<up> <up> <up> <up> <end> <up> <left> <left> <C-S-left>
<delete> s o m e w <backspace> v e c t o r <down> <left>
<C-S-left> <delete> s o e <backspace> m e o t h e r
v e c t o r <tab> <down> <tab> <C-left> y e t a n o
t h <C-S-left> <delete> a g l m <delete> <delete> <delete>
<delete> <down> <down> <up> <right> <right> <right>
<right> <right> g l m <tab> <down> <down> <down> <down>
<down> <tab> <down> <tab> <down> <tab> <up> <up> <up>
<up> <up> <up> <tab> <C-right> <C-right> <C-right>
<C-right> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> s e <backspace>
o m e i n t <tab> <tab> <down> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
s o m e i n t <tab> <tab> <backspace> <backspace> <backspace>
<backspace> e o t h e r i n t <tab> <tab> <down> <tab>
<down> <tab> <down> <C-left> <C-left> <C-left> <delete>
<delete> <delete> <delete> <delete> <delete> s o m
e v e c t o r <right> <right> <right> <right> <C-S-right>
<delete> s o m e v e c t o r <tab> <tab> <down> <tab>
<tab> <right> <C-right> <C-S-left> <delete> s o m e
i n t <C-right> <right> <C-S-right> <delete> s o m
e n t i <backspace> <backspace> <backspace> i n t <tab>
<tab> <up> <tab> <down> <tab> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <home> <S-down> <S-down> <S-down>
<S-down> <S-down> <S-down> <S-down> <S-down> <S-down>
<S-down> <S-down> <S-delete> <delete> <help-echo> <down-mouse-1>
<mouse-1> M-x r e p <tab> o r <tab> <return>

Recent messages:
Auto-saving...done
Mark set [5 times]
Auto-saving...done
Mark set [5 times]
To Remove Middle Tag: (Somefunction)
Mark set [2 times]
Parsing raycast.cpp (LL)...done
Auto-saving...
Making completion list...
byte-code: Beginning of buffer [2 times]

Load-path shadows:
~/.emacs.d/lisp/cmake-mode hides /usr/share/emacs24/site-lisp/cmake-data/cmake-mode
~/.emacs.d/lisp/asy-mode hides /usr/share/emacs/site-lisp/asy-mode
~/.emacs.d/lisp/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.3/lisp/language/thai-word

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils cuda-mode cl-macs help-fns rect vc-hg misearch
multi-isearch vc-git semantic/edit semantic/tag-write vc-dispatcher
vc-svn semantic/tag-file ede/linux ede/make semantic/db-file data-debug
ring cedet-files semantic/bovine/c semantic/decorate/include
semantic/decorate/mode semantic/decorate pulse hideif semantic/db-find
semantic/db-ref semantic/bovine/c-by semantic/lex-spp
semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze
semantic/sort semantic/scope semantic/analyze/fcn hideshow cc-langs
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs help-mode cmake-mode thingatpt workgroups cl cl-lib
edmacro kmacro ede/cpp-root ede/emacs ede/speedbar ede/files ede
ede/base ede/auto ede/source eieio-speedbar speedbar sb-image dframe
eieio-custom wid-edit semantic/db-mode semantic/db gv eieio-base
semantic/idle semantic/format ezimage semantic/tag-ls semantic/find
semantic/ctxt semantic/util-modes easymenu semantic/util semantic
semantic/tag semantic/lex semantic/fw eieio byte-opt bytecomp
byte-compile cconv mode-local cedet iso-transl emacs-goodies-el
emacs-goodies-custom emacs-goodies-loaddefs easy-mmode time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)