all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#341: c-indent-command misindents?
@ 2008-05-31 15:13 Ralovich, Kristóf 
  2008-06-18 11:09 ` Fwd: " Ralovich, Kristóf
  2015-12-29  0:48 ` bug#341: " Andrew Hyatt
  0 siblings, 2 replies; 7+ messages in thread
From: Ralovich, Kristóf  @ 2008-05-31 15:13 UTC (permalink / raw)
  To: bug-gnu-emacs, bug-cc-mode

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

Hi,

I hope this letter ends up at the right maintainers!

My problem is when running c-indent-command (by pressing TAB or
calling it directly) on the 4th line of the following small snippet
(same as attached file):

1: #ifdef A
2: int foo(int a, int b)
3: #else
4: int bar(int a, int b)
5: #endif
6: {
7:   return a+b;
8: }

the line is getting indented falsely:

1: #ifdef A
2: int foo(int a, int b)
3: #else
4:   int bar(int a, int b)
5: #endif
6: {
7:   return a+b;
8: }

I think, it should not get indented, please correct me if I am wrong!

I am using emacs 22.2 with it's default cc-mode.

Looking forward to hearing from you!


Kristóf

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cc-mode-bug.c --]
[-- Type: text/x-csrc; name=cc-mode-bug.c, Size: 84 bytes --]

#ifdef A
int foo(int a, int b)
#else
int bar(int a, int b)
#endif
{
  return a+b;
}

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

* Fwd: c-indent-command misindents?
  2008-05-31 15:13 bug#341: c-indent-command misindents? Ralovich, Kristóf 
@ 2008-06-18 11:09 ` Ralovich, Kristóf
  2015-12-29  0:48 ` bug#341: " Andrew Hyatt
  1 sibling, 0 replies; 7+ messages in thread
From: Ralovich, Kristóf @ 2008-06-18 11:09 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

Hi,

a few weeks ago I have submitted a bug report, now at:
http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=341

Would someone please have a look at it?

Thanks,
Kristof


---------- Forwarded message ----------
From: Ralovich, Kristóf <kristof.ralovich@gmail.com>
Date: Sat, May 31, 2008 at 5:13 PM
Subject: c-indent-command misindents?
To: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org


Hi,

I hope this letter ends up at the right maintainers!

My problem is when running c-indent-command (by pressing TAB or
calling it directly) on the 4th line of the following small snippet
(same as attached file):

1: #ifdef A
2: int foo(int a, int b)
3: #else
4: int bar(int a, int b)
5: #endif
6: {
7:   return a+b;
8: }

the line is getting indented falsely:

1: #ifdef A
2: int foo(int a, int b)
3: #else
4:   int bar(int a, int b)
5: #endif
6: {
7:   return a+b;
8: }

I think, it should not get indented, please correct me if I am wrong!

I am using emacs 22.2 with it's default cc-mode.

Looking forward to hearing from you!


Kristóf

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: cc-mode-bug.c --]
[-- Type: text/x-csrc; name=cc-mode-bug.c, Size: 84 bytes --]

#ifdef A
int foo(int a, int b)
#else
int bar(int a, int b)
#endif
{
  return a+b;
}

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

* bug#341: c-indent-command misindents?
  2008-05-31 15:13 bug#341: c-indent-command misindents? Ralovich, Kristóf 
  2008-06-18 11:09 ` Fwd: " Ralovich, Kristóf
@ 2015-12-29  0:48 ` Andrew Hyatt
  2015-12-29 20:33   ` Alan Mackenzie
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Hyatt @ 2015-12-29  0:48 UTC (permalink / raw)
  To: Ralovich, Kristóf; +Cc: 341


I've reproduced this bug in emacs 25.

It seems like a real problem, thanks (belatedly) for reporting!

"Ralovich, "Kristóf\"" <kristof.ralovich@gmail.com> writes:

> Hi,
>
> I hope this letter ends up at the right maintainers!
>
> My problem is when running c-indent-command (by pressing TAB or
> calling it directly) on the 4th line of the following small snippet
> (same as attached file):
>
> 1: #ifdef A
> 2: int foo(int a, int b)
> 3: #else
> 4: int bar(int a, int b)
> 5: #endif
> 6: {
> 7:   return a+b;
> 8: }
>
> the line is getting indented falsely:
>
> 1: #ifdef A
> 2: int foo(int a, int b)
> 3: #else
> 4:   int bar(int a, int b)
> 5: #endif
> 6: {
> 7:   return a+b;
> 8: }
>
> I think, it should not get indented, please correct me if I am wrong!
>
> I am using emacs 22.2 with it's default cc-mode.
>
> Looking forward to hearing from you!
>
>
> Kristóf





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

* bug#341: c-indent-command misindents?
  2015-12-29  0:48 ` bug#341: " Andrew Hyatt
@ 2015-12-29 20:33   ` Alan Mackenzie
  2015-12-29 20:38     ` Andrew Hyatt
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2015-12-29 20:33 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: Ralovich, Kristóf, 341

Hello Andrew and Kristóf.

On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote:

> I've reproduced this bug in emacs 25.

> It seems like a real problem, thanks (belatedly) for reporting!

Yes, it's a known problem in CC Mode, and it's seriously difficult to
fix.  Parsing happens mainly in the backwards direction, and in general,
the #ifdefs in a file form a tree structure.  Which is the line previous
to line 6?  It could be L4, it could be L2.  Typically, such "parallel"
text lines aren't nice and compatible, the way they are in this example.
Indeed, it's possible to construct an example where L6 has two
alternative syntactic contexts, depending on whether A is defined.  In
fact, something like:

#ifdef A
int foo(int a, int b)
#else
int bar(int a, int b)
{
  if (a > b)
#endif
{
  return a+b;
}

would do it.

I don't know if this problem will ever be fixed.

> "Ralovich, "Kristóf\"" <kristof.ralovich@gmail.com> writes:

> > Hi,

> > I hope this letter ends up at the right maintainers!

> > My problem is when running c-indent-command (by pressing TAB or
> > calling it directly) on the 4th line of the following small snippet
> > (same as attached file):

> > 1: #ifdef A
> > 2: int foo(int a, int b)
> > 3: #else
> > 4: int bar(int a, int b)
> > 5: #endif
> > 6: {
> > 7:   return a+b;
> > 8: }

> > the line is getting indented falsely:

> > 1: #ifdef A
> > 2: int foo(int a, int b)
> > 3: #else
> > 4:   int bar(int a, int b)
> > 5: #endif
> > 6: {
> > 7:   return a+b;
> > 8: }

> > I think, it should not get indented, please correct me if I am wrong!

> > I am using emacs 22.2 with it's default cc-mode.

> > Looking forward to hearing from you!


> > Kristóf

-- 
Alan Mackenzie (Nuremberg, Germany).





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

* bug#341: c-indent-command misindents?
  2015-12-29 20:33   ` Alan Mackenzie
@ 2015-12-29 20:38     ` Andrew Hyatt
  2016-01-11  3:12       ` Andrew Hyatt
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Hyatt @ 2015-12-29 20:38 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Ralovich, Kristóf, 341

[-- Attachment #1: Type: text/plain, Size: 2153 bytes --]

On Tue, Dec 29, 2015 at 3:30 PM Alan Mackenzie <acm@muc.de> wrote:

> Hello Andrew and Kristóf.
>
> On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote:
>
> > I've reproduced this bug in emacs 25.
>
> > It seems like a real problem, thanks (belatedly) for reporting!
>
> Yes, it's a known problem in CC Mode, and it's seriously difficult to
> fix.  Parsing happens mainly in the backwards direction, and in general,
> the #ifdefs in a file form a tree structure.  Which is the line previous
> to line 6?  It could be L4, it could be L2.  Typically, such "parallel"
> text lines aren't nice and compatible, the way they are in this example.
> Indeed, it's possible to construct an example where L6 has two
> alternative syntactic contexts, depending on whether A is defined.  In
> fact, something like:
>
> #ifdef A
> int foo(int a, int b)
> #else
> int bar(int a, int b)
> {
>   if (a > b)
> #endif
> {
>   return a+b;
> }
>
> would do it.
>
> I don't know if this problem will ever be fixed.
>

Perhaps the right thing to do is to mark it as "wontfix" since it's
unlikely to be possible without a big rewrite.  What do you think?


>
> > "Ralovich, "Kristóf\"" <kristof.ralovich@gmail.com> writes:
>
> > > Hi,
>
> > > I hope this letter ends up at the right maintainers!
>
> > > My problem is when running c-indent-command (by pressing TAB or
> > > calling it directly) on the 4th line of the following small snippet
> > > (same as attached file):
>
> > > 1: #ifdef A
> > > 2: int foo(int a, int b)
> > > 3: #else
> > > 4: int bar(int a, int b)
> > > 5: #endif
> > > 6: {
> > > 7:   return a+b;
> > > 8: }
>
> > > the line is getting indented falsely:
>
> > > 1: #ifdef A
> > > 2: int foo(int a, int b)
> > > 3: #else
> > > 4:   int bar(int a, int b)
> > > 5: #endif
> > > 6: {
> > > 7:   return a+b;
> > > 8: }
>
> > > I think, it should not get indented, please correct me if I am wrong!
>
> > > I am using emacs 22.2 with it's default cc-mode.
>
> > > Looking forward to hearing from you!
>
>
> > > Kristóf
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>

[-- Attachment #2: Type: text/html, Size: 3018 bytes --]

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

* bug#341: c-indent-command misindents?
  2015-12-29 20:38     ` Andrew Hyatt
@ 2016-01-11  3:12       ` Andrew Hyatt
  2016-01-11 13:35         ` Alan Mackenzie
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Hyatt @ 2016-01-11  3:12 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Ralovich, 341, Kristóf

Andrew Hyatt <ahyatt@gmail.com> writes:

> On Tue, Dec 29, 2015 at 3:30 PM Alan Mackenzie <acm@muc.de> wrote:
>
>
>  Hello Andrew and Kristóf.
>
>  On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote:
>
>  > I've reproduced this bug in emacs 25.
>
>  > It seems like a real problem, thanks (belatedly) for reporting!
>
>  Yes, it's a known problem in CC Mode, and it's seriously difficult to
>  fix. Parsing happens mainly in the backwards direction, and in general,
>  the #ifdefs in a file form a tree structure. Which is the line previous
>  to line 6? It could be L4, it could be L2. Typically, such "parallel"
>  text lines aren't nice and compatible, the way they are in this example.
>  Indeed, it's possible to construct an example where L6 has two
>  alternative syntactic contexts, depending on whether A is defined. In
>  fact, something like:
>
>  #ifdef A
>  int foo(int a, int b)
>  #else
>  int bar(int a, int b)
>  {
>  if (a > b)
>  #endif
>  {
>  return a+b;
>  }
>
>  would do it.
>
>  I don't know if this problem will ever be fixed.
>
>
> Perhaps the right thing to do is to mark it as "wontfix" since it's unlikely to be possible without a big rewrite. What do you think?

I'm going to go ahead and do that, due to lack of opposition. Please
unmark or just let me know if you disagree.

>
>
>  > "Ralovich, "Kristóf\"" <kristof.ralovich@gmail.com> writes:
>
>  > > Hi,
>
>  > > I hope this letter ends up at the right maintainers!
>
>  > > My problem is when running c-indent-command (by pressing TAB or
>  > > calling it directly) on the 4th line of the following small snippet
>  > > (same as attached file):
>
>  > > 1: #ifdef A
>  > > 2: int foo(int a, int b)
>  > > 3: #else
>  > > 4: int bar(int a, int b)
>  > > 5: #endif
>  > > 6: {
>  > > 7: return a+b;
>  > > 8: }
>
>  > > the line is getting indented falsely:
>
>  > > 1: #ifdef A
>  > > 2: int foo(int a, int b)
>  > > 3: #else
>  > > 4: int bar(int a, int b)
>  > > 5: #endif
>  > > 6: {
>  > > 7: return a+b;
>  > > 8: }
>
>  > > I think, it should not get indented, please correct me if I am wrong!
>
>  > > I am using emacs 22.2 with it's default cc-mode.
>
>  > > Looking forward to hearing from you!
>
>  > > Kristóf
>
>  --
>  Alan Mackenzie (Nuremberg, Germany).





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

* bug#341: c-indent-command misindents?
  2016-01-11  3:12       ` Andrew Hyatt
@ 2016-01-11 13:35         ` Alan Mackenzie
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2016-01-11 13:35 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: Ralovich, 341, Kristóf

Hello, Andrew.

On Sun, Jan 10, 2016 at 10:12:40PM -0500, Andrew Hyatt wrote:
> Andrew Hyatt <ahyatt@gmail.com> writes:

> > On Tue, Dec 29, 2015 at 3:30 PM Alan Mackenzie <acm@muc.de> wrote:


> >  Hello Andrew and Kristóf.

> >  On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote:

> >  > I've reproduced this bug in emacs 25.

> >  > It seems like a real problem, thanks (belatedly) for reporting!

> >  Yes, it's a known problem in CC Mode, and it's seriously difficult to
> >  fix. Parsing happens mainly in the backwards direction, and in general,
> >  the #ifdefs in a file form a tree structure. Which is the line previous
> >  to line 6? It could be L4, it could be L2. Typically, such "parallel"
> >  text lines aren't nice and compatible, the way they are in this example.
> >  Indeed, it's possible to construct an example where L6 has two
> >  alternative syntactic contexts, depending on whether A is defined. In
> >  fact, something like:

> >  #ifdef A
> >  int foo(int a, int b)
> >  #else
> >  int bar(int a, int b)
> >  {
> >  if (a > b)
> >  #endif
> >  {
> >  return a+b;
> >  }

> >  would do it.

> >  I don't know if this problem will ever be fixed.


> > Perhaps the right thing to do is to mark it as "wontfix" since it's
> > unlikely to be possible without a big rewrite. What do you think?

> I'm going to go ahead and do that, due to lack of opposition. Please
> unmark or just let me know if you disagree.

Yes, I suppose that's the best thing to do, although I'm ambivalent about
it.  Maybe sometime in the distant future there will perhaps be extra
support in the syntax functionality which would make a fix for this
easier to design and implement.  Maybe.  <Sigh>.

So, yes, please go ahead and close it as "won't fix".

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).





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

end of thread, other threads:[~2016-01-11 13:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-31 15:13 bug#341: c-indent-command misindents? Ralovich, Kristóf 
2008-06-18 11:09 ` Fwd: " Ralovich, Kristóf
2015-12-29  0:48 ` bug#341: " Andrew Hyatt
2015-12-29 20:33   ` Alan Mackenzie
2015-12-29 20:38     ` Andrew Hyatt
2016-01-11  3:12       ` Andrew Hyatt
2016-01-11 13:35         ` Alan Mackenzie

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.