unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
@ 2010-11-03 23:25 Christoph
  2016-09-08  4:57 ` Alex
  2021-06-02  8:48 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph @ 2010-11-03 23:25 UTC (permalink / raw)
  To: 7327

Start with `emacs -Q'. Start new .c file.

Type `typedef enum' then hit `C-j', then `{'.

The code is indented like this:

typedef enum
  {
    blabla

Then try `typedef struct', `C-j', '{'.

The code is indented like this:

typedef struct
{
  blabla

This happens in 24.0.50, bzr revision 102241 and also 23.2.1.

I don't know which one is right, but I think the indentation should by
default be consistent.


In GNU Emacs 24.0.50.1 (i386-mingw-nt6.1.7600)
 of 2010-11-03 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7600
configured using `configure --with-gcc (4.5) --cflags -IC:/Progra~2/GnuWin32/include -ID:/devel/emacs/libXpm-3.5.8/include -ID:/devel/emacs/libXpm-3.5.8/src'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  ido-everywhere: t
  yas/global-mode: t
  yas/minor-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  mouse-wheel-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
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t

Recent input:
C-x RET r e p o r t <tab> <return>

Recent messages:
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/windows.el (source)...done
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/plugins.el (source)...
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/plugins/color-theme/themes/color-theme-example.el (source)...done
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/plugins/color-theme/themes/color-theme-library.el (source)...done
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/plugins/zenburn.el (source)...done
Ido mode enabled
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/anything-c-adaptive-history...done
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/plugins.el (source)...done
Loading c:/Users/Christoph/AppData/Roaming/.emacs.d/custom.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader emacsbug
server js2-mode-autoloads rainbow-mode-autoloads package re-builder
dired+ dired-x ediff-merg ediff-diff ediff-wind ediff-mult ediff-help
ediff-init ediff-util dired-aux ibuffer nav nav-tags python-21 python
nav-bufs anything-config warnings browse-url semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw loaddefs
eieio byte-opt bytecomp byte-compile mode-local cedet imenu bookmark pp
dired rx ffap thingatpt anything google-c-style cc-mode cc-fonts
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
grep-o-matic grep compile comint browse-kill-ring+ browse-kill-ring
second-sel ido yasnippet dropdown-list derived easy-mmode assoc
etags-table etags ring remember zenburn color-theme edmacro kmacro
wid-edit cl sendmail regexp-opt reporter easymenu uniquify advice
help-fns advice-preload autorevert tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars
tool-bar dnd fontset image fringe 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 button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process multi-tty
emacs)





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
  2010-11-03 23:25 bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs Christoph
@ 2016-09-08  4:57 ` Alex
  2021-06-02  8:48 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Alex @ 2016-09-08  4:57 UTC (permalink / raw)
  To: Christoph; +Cc: 7327, Alan Mackenzie

tags found 24.5 25.1
quit

Christoph <cschol2112@googlemail.com> writes:

> Start with `emacs -Q'. Start new .c file.
>
> Type `typedef enum' then hit `C-j', then `{'.
>
> The code is indented like this:
>
> typedef enum
>   {
>     blabla
>
> Then try `typedef struct', `C-j', '{'.
>
> The code is indented like this:
>
> typedef struct
> {
>   blabla
>
> This happens in 24.0.50, bzr revision 102241 and also 23.2.1.
>
> I don't know which one is right, but I think the indentation should by
> default be consistent.

This behaviour is still present in Emacs 25.1; is it intentional?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
  2010-11-03 23:25 bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs Christoph
  2016-09-08  4:57 ` Alex
@ 2021-06-02  8:48 ` Lars Ingebrigtsen
  2021-06-03 11:38   ` Alan Mackenzie
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-02  8:48 UTC (permalink / raw)
  To: Christoph; +Cc: 7327, Alan Mackenzie

Christoph <cschol2112@googlemail.com> writes:

> Start with `emacs -Q'. Start new .c file.
>
> Type `typedef enum' then hit `C-j', then `{'.
>
> The code is indented like this:
>
> typedef enum
>   {
>     blabla
>
> Then try `typedef struct', `C-j', '{'.
>
> The code is indented like this:
>
> typedef struct
> {
>   blabla

This behaviour is still present in Emacs 28.

Alan, is this behaving as designed, or is it a bug?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
  2021-06-02  8:48 ` Lars Ingebrigtsen
@ 2021-06-03 11:38   ` Alan Mackenzie
  2021-06-04  8:32     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2021-06-03 11:38 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Christoph, 7327

Hello, Lars

On Wed, Jun 02, 2021 at 10:48:11 +0200, Lars Ingebrigtsen wrote:
> Christoph <cschol2112@googlemail.com> writes:

> > Start with `emacs -Q'. Start new .c file.

> > Type `typedef enum' then hit `C-j', then `{'.

> > The code is indented like this:

> > typedef enum
> >   {
> >     blabla

> > Then try `typedef struct', `C-j', '{'.

> > The code is indented like this:

> > typedef struct
> > {
> >   blabla

> This behaviour is still present in Emacs 28.

> Alan, is this behaving as designed, or is it a bug?

It's kind of both.  The issue came up on 2014-02-19 in a post from Xue
Fuqiao on the CC Mode list.  This behaviour has been in place since at
least 2000-01-16, and I decided in 2014 that to fix the bug would result
in too much chaos, with "typedef enum"s, lots of them, suddenly becoming
mis-indented.

The root of the problem is that the CC Mode syntactic symbol
brace-list-open is used for both typedef enums (as above) and for the
initialisation of structs with literals.  This economy was a mistake,
with the benefit of hindsight.

So I think I would still rather not fix this bug, since it has at least
two decades' standing.

Sorry!

> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

-- 
Alan Mackenzie (Nuremberg, Germany).





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
  2021-06-03 11:38   ` Alan Mackenzie
@ 2021-06-04  8:32     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-06-04  8:32 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Christoph, 7327

Alan Mackenzie <acm@muc.de> writes:

> So I think I would still rather not fix this bug, since it has at least
> two decades' standing.

Thanks for the explanation.  I'm closing this bug report, then.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-04  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-03 23:25 bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs Christoph
2016-09-08  4:57 ` Alex
2021-06-02  8:48 ` Lars Ingebrigtsen
2021-06-03 11:38   ` Alan Mackenzie
2021-06-04  8:32     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).