unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* C Mode possibility: optionally disabling K&R function headers. WDYT?
@ 2011-12-08 11:25 Alan Mackenzie
  2011-12-08 13:40 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2011-12-08 11:25 UTC (permalink / raw)
  To: emacs-devel, xemacs-beta

Hello Emacs and XEmacs.

I've got a knotty problem with a C Mode bug report: The use of a macro
in a typedef definition causes the following line to be parsed as a K&R
parameter.  The actual code is this:

    #ifndef G
    #define G(symbol) pieni_ ## symbol
    #endif

    typedef struct G(foobar) *G(foobar_t);
                             typedef int lahna;  <=========== K&R

Solving this bug is difficult.  One way would be just to disable K&R in
C Mode, except when explicitly enabled by the user.  After all, K&R
parameters have been obsolete for over 10 years now.

The key sequnce to toggle it would be C-c C-k.

Can anybody think up any reasons why this would be a Bad Thing.  Does
anybody feel particularly strongly about this?

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: C Mode possibility: optionally disabling K&R function headers. WDYT?
  2011-12-08 11:25 C Mode possibility: optionally disabling K&R function headers. WDYT? Alan Mackenzie
@ 2011-12-08 13:40 ` Stefan Monnier
  2011-12-09  4:55   ` Stephen J. Turnbull
  2011-12-09 13:53   ` Alan Mackenzie
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-12-08 13:40 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: xemacs-beta, emacs-devel

> Solving this bug is difficult.  One way would be just to disable K&R in
> C Mode, except when explicitly enabled by the user.  After all, K&R
> parameters have been obsolete for over 10 years now.

> The key sequnce to toggle it would be C-c C-k.

> Can anybody think up any reasons why this would be a Bad Thing.  Does
> anybody feel particularly strongly about this?

I think introducing a config var to disable K&R would be great
(especially since IIUC it is a source of trouble, including peformance
trouble).  I don't see any need for a key-binding to toggle it, tho.
And I'd rather keep it ON by default for 24.1.


        Stefan



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

* Re: C Mode possibility: optionally disabling K&R function headers. WDYT?
  2011-12-08 13:40 ` Stefan Monnier
@ 2011-12-09  4:55   ` Stephen J. Turnbull
  2011-12-09 14:00     ` Alan Mackenzie
  2011-12-09 13:53   ` Alan Mackenzie
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen J. Turnbull @ 2011-12-09  4:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Alan Mackenzie, emacs-devel, xemacs-beta

Stefan Monnier writes:
 > > Solving this bug is difficult.  One way would be just to disable K&R in
 > > C Mode, except when explicitly enabled by the user.  After all, K&R
 > > parameters have been obsolete for over 10 years now.
 > 
 > > The key sequnce to toggle it would be C-c C-k.
 > 
 > > Can anybody think up any reasons why this would be a Bad Thing.  Does
 > > anybody feel particularly strongly about this?
 > 
 > I think introducing a config var to disable K&R would be great
 > (especially since IIUC it is a source of trouble, including peformance
 > trouble).

+1 from XEmacs.

 > I don't see any need for a key-binding to toggle it, tho.

+1 from XEmacs.

 > And I'd rather keep it ON by default for 24.1.

XEmacs will make its own judgment on defaults for XEmacs. :-)  I don't
have an opinion at the moment.

I don't understand why this is a problem though.  Does K&R allow
typedef declarations in parameter lists?



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

* Re: C Mode possibility: optionally disabling K&R function headers. WDYT?
  2011-12-08 13:40 ` Stefan Monnier
  2011-12-09  4:55   ` Stephen J. Turnbull
@ 2011-12-09 13:53   ` Alan Mackenzie
  2011-12-09 21:11     ` Stefan Monnier
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2011-12-09 13:53 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: xemacs-beta, emacs-devel

On Thu, Dec 08, 2011 at 08:40:38AM -0500, Stefan Monnier wrote:
> > Solving this bug is difficult.  One way would be just to disable K&R in
> > C Mode, except when explicitly enabled by the user.  After all, K&R
> > parameters have been obsolete for over 10 years now.

> > The key sequnce to toggle it would be C-c C-k.

> > Can anybody think up any reasons why this would be a Bad Thing.  Does
> > anybody feel particularly strongly about this?

> I think introducing a config var to disable K&R would be great
> (especially since IIUC it is a source of trouble, including peformance
> trouble).

I'm thinking more of a buffer local toggle.  There're going to be times
when some hacker suddenly comes across a file with K&R function decls and
will want to be able to toggle it effortlessly.

> I don't see any need for a key-binding to toggle it, tho.

Maybe, maybe not.  But it wouldn't do any harm.  (There are 11 spare C-c
C-<letter> bindings still unused in CC Mode.)

> And I'd rather keep it ON by default for 24.1.

That's fine.  But I was more thinking of it as a new feature than a bug
fix, and thus for CC Mode 5.33 / Emacs 25.  I've no particularly strong
feelings as to the default; I think it should be OFF eventually, but
leaving it ON to begin with seems sensible.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: C Mode possibility: optionally disabling K&R function headers. WDYT?
  2011-12-09  4:55   ` Stephen J. Turnbull
@ 2011-12-09 14:00     ` Alan Mackenzie
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Mackenzie @ 2011-12-09 14:00 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: xemacs-beta, Stefan Monnier, emacs-devel

On Fri, Dec 09, 2011 at 01:55:01PM +0900, Stephen J. Turnbull wrote:
> Stefan Monnier writes:
>  > > Solving this bug is difficult.  One way would be just to disable K&R in
>  > > C Mode, except when explicitly enabled by the user.  After all, K&R
>  > > parameters have been obsolete for over 10 years now.

>  > > The key sequnce to toggle it would be C-c C-k.

>  > And I'd rather keep it ON by default for 24.1.

> XEmacs will make its own judgment on defaults for XEmacs. :-)  I don't
> have an opinion at the moment.

:-)

> I don't understand why this is a problem though.  Does K&R allow
> typedef declarations in parameter lists?

No, but that's a poor criterion for detecting the absence of K&R.  That
typedef could just as well be a variable declaration.

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: C Mode possibility: optionally disabling K&R function headers. WDYT?
  2011-12-09 13:53   ` Alan Mackenzie
@ 2011-12-09 21:11     ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-12-09 21:11 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: xemacs-beta, emacs-devel

>> I don't see any need for a key-binding to toggle it, tho.
> Maybe, maybe not.  But it wouldn't do any harm.  (There are 11 spare C-c
> C-<letter> bindings still unused in CC Mode.)

Your call.  To me, the need for dynamically toggling it is simply
unimaginable, and "11" sounds very small, and the added code needed to
support it (docstring, code to force a reparse, etc...).

>> And I'd rather keep it ON by default for 24.1.
> That's fine.  But I was more thinking of it as a new feature than a bug
> fix, and thus for CC Mode 5.33 / Emacs 25.

I'd be very happy to have it for 24.2 (and to set it to OFF in Emacs's
.dir-locals.el).

> I've no particularly strong feelings as to the default; I think it
> should be OFF eventually, but leaving it ON to begin with
> seems sensible.

I don't have an opinion on the default after 24.1 (tho bug reports
during the 24.2 pretest may change that, of course ;-).


        Stefan



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

end of thread, other threads:[~2011-12-09 21:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08 11:25 C Mode possibility: optionally disabling K&R function headers. WDYT? Alan Mackenzie
2011-12-08 13:40 ` Stefan Monnier
2011-12-09  4:55   ` Stephen J. Turnbull
2011-12-09 14:00     ` Alan Mackenzie
2011-12-09 13:53   ` Alan Mackenzie
2011-12-09 21:11     ` Stefan Monnier

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