unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34594: cc-mode needs to support "final" in C++ classes
@ 2019-02-20 18:33 Daniel Colascione
  2019-02-20 19:34 ` Daniel Colascione
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Colascione @ 2019-02-20 18:33 UTC (permalink / raw)
  To: 34594

Consider this:

1 struct QueryCache final : BasePyObject, SupportsGcClear,
2                           HasDict, SupportsWeakRefs

Without the "final", line 2 is classified as inher-cont.  With the
"final", it gets topmost-intro-cont and wrong indentation.






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

* bug#34594: cc-mode needs to support "final" in C++ classes
  2019-02-20 18:33 bug#34594: cc-mode needs to support "final" in C++ classes Daniel Colascione
@ 2019-02-20 19:34 ` Daniel Colascione
  2019-04-13  2:54   ` Daniel Colascione
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Colascione @ 2019-02-20 19:34 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: 34594

> Consider this:
>
> 1 struct QueryCache final : BasePyObject, SupportsGcClear,
> 2                           HasDict, SupportsWeakRefs
>
> Without the "final", line 2 is classified as inher-cont.  With the
> "final", it gets topmost-intro-cont and wrong indentation.

Proposed fix:

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index b4c12896f3..121888d825 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -12268,6 +12268,9 @@ c-guess-basic-syntax
 			(if (eq (char-after) ?<)
 			    (zerop (c-forward-token-2 1 t indent-point))
 			  t)
+			(if (looking-at "final\\>[^_]")
+			    (c-forward-token-2 1 nil indent-point)
+			  t)
 			(eq (char-after) ?:))))
 	    (goto-char placeholder)
 	    (c-add-syntax 'inher-cont (c-point 'boi)))







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

* bug#34594: cc-mode needs to support "final" in C++ classes
  2019-02-20 19:34 ` Daniel Colascione
@ 2019-04-13  2:54   ` Daniel Colascione
  2019-04-13 13:36     ` Alan Mackenzie
  2019-04-26 14:29     ` Alan Mackenzie
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Colascione @ 2019-04-13  2:54 UTC (permalink / raw)
  Cc: Alan Mackenzie, 34594

+ Alan

On 2/20/19 11:34 AM, Daniel Colascione wrote:
>> Consider this:
>>
>> 1 struct QueryCache final : BasePyObject, SupportsGcClear,
>> 2                           HasDict, SupportsWeakRefs
>>
>> Without the "final", line 2 is classified as inher-cont.  With the
>> "final", it gets topmost-intro-cont and wrong indentation.
> 
> Proposed fix:
> 
> diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
> index b4c12896f3..121888d825 100644
> --- a/lisp/progmodes/cc-engine.el
> +++ b/lisp/progmodes/cc-engine.el
> @@ -12268,6 +12268,9 @@ c-guess-basic-syntax
>   			(if (eq (char-after) ?<)
>   			    (zerop (c-forward-token-2 1 t indent-point))
>   			  t)
> +			(if (looking-at "final\\>[^_]")
> +			    (c-forward-token-2 1 nil indent-point)
> +			  t)
>   			(eq (char-after) ?:))))
>   	    (goto-char placeholder)
>   	    (c-add-syntax 'inher-cont (c-point 'boi)))
> 





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

* bug#34594: cc-mode needs to support "final" in C++ classes
  2019-04-13  2:54   ` Daniel Colascione
@ 2019-04-13 13:36     ` Alan Mackenzie
  2019-04-13 13:57       ` Mauro Aranda
  2019-04-26 14:29     ` Alan Mackenzie
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2019-04-13 13:36 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: 34594

Hello, Daniel.

I've fixed this in master, pretty much as you suggested.

Feel free to try out the fix, and to tell me it isn't quite working.
;-)

-- 
Alan Mackenzie (Nuremberg, Germany).


On Fri, Apr 12, 2019 at 19:54:36 -0700, Daniel Colascione wrote:
> + Alan

> On 2/20/19 11:34 AM, Daniel Colascione wrote:
> >> Consider this:
> >>
> >> 1 struct QueryCache final : BasePyObject, SupportsGcClear,
> >> 2                           HasDict, SupportsWeakRefs
> >>
> >> Without the "final", line 2 is classified as inher-cont.  With the
> >> "final", it gets topmost-intro-cont and wrong indentation.
> > 
> > Proposed fix:
> > 
> > diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
> > index b4c12896f3..121888d825 100644
> > --- a/lisp/progmodes/cc-engine.el
> > +++ b/lisp/progmodes/cc-engine.el
> > @@ -12268,6 +12268,9 @@ c-guess-basic-syntax
> >   			(if (eq (char-after) ?<)
> >   			    (zerop (c-forward-token-2 1 t indent-point))
> >   			  t)
> > +			(if (looking-at "final\\>[^_]")
> > +			    (c-forward-token-2 1 nil indent-point)
> > +			  t)
> >   			(eq (char-after) ?:))))
> >   	    (goto-char placeholder)
> >   	    (c-add-syntax 'inher-cont (c-point 'boi)))
> > 





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

* bug#34594: cc-mode needs to support "final" in C++ classes
  2019-04-13 13:36     ` Alan Mackenzie
@ 2019-04-13 13:57       ` Mauro Aranda
  2019-04-13 19:43         ` Alan Mackenzie
  0 siblings, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2019-04-13 13:57 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 34594

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

Hello Alan,

Just a minor typo: In c-class-id-suffix-ws-ids-kwds, "syntactially"

Best regards,
Mauro.

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

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

* bug#34594: cc-mode needs to support "final" in C++ classes
  2019-04-13 13:57       ` Mauro Aranda
@ 2019-04-13 19:43         ` Alan Mackenzie
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2019-04-13 19:43 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 34594

Hello, Mauro.

On Sat, Apr 13, 2019 at 10:57:32 -0300, Mauro Aranda wrote:
> Hello Alan,

> Just a minor typo: In c-class-id-suffix-ws-ids-kwds, "syntactially"

Yes.  I've fixed it now.  Thanks for pointing it out.

> Best regards,
> Mauro.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

* bug#34594: cc-mode needs to support "final" in C++ classes
  2019-04-13  2:54   ` Daniel Colascione
  2019-04-13 13:36     ` Alan Mackenzie
@ 2019-04-26 14:29     ` Alan Mackenzie
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2019-04-26 14:29 UTC (permalink / raw)
  To: Daniel Colascione; +Cc: 34594-done

Hello, Daniel.

The bug has been fixed, so I'm closing it.

-- 
Alan Mackenzie (Nuremberg, Germany).


On Fri, Apr 12, 2019 at 19:54:36 -0700, Daniel Colascione wrote:
> + Alan

> On 2/20/19 11:34 AM, Daniel Colascione wrote:
> >> Consider this:
> >>
> >> 1 struct QueryCache final : BasePyObject, SupportsGcClear,
> >> 2                           HasDict, SupportsWeakRefs
> >>
> >> Without the "final", line 2 is classified as inher-cont.  With the
> >> "final", it gets topmost-intro-cont and wrong indentation.
> > 
> > Proposed fix:
> > 
> > diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
> > index b4c12896f3..121888d825 100644
> > --- a/lisp/progmodes/cc-engine.el
> > +++ b/lisp/progmodes/cc-engine.el
> > @@ -12268,6 +12268,9 @@ c-guess-basic-syntax
> >   			(if (eq (char-after) ?<)
> >   			    (zerop (c-forward-token-2 1 t indent-point))
> >   			  t)
> > +			(if (looking-at "final\\>[^_]")
> > +			    (c-forward-token-2 1 nil indent-point)
> > +			  t)
> >   			(eq (char-after) ?:))))
> >   	    (goto-char placeholder)
> >   	    (c-add-syntax 'inher-cont (c-point 'boi)))
> > 





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

end of thread, other threads:[~2019-04-26 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-20 18:33 bug#34594: cc-mode needs to support "final" in C++ classes Daniel Colascione
2019-02-20 19:34 ` Daniel Colascione
2019-04-13  2:54   ` Daniel Colascione
2019-04-13 13:36     ` Alan Mackenzie
2019-04-13 13:57       ` Mauro Aranda
2019-04-13 19:43         ` Alan Mackenzie
2019-04-26 14:29     ` Alan Mackenzie

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).