unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Should there be a k&r2 c-style?
@ 2016-09-09 19:24 Alex
  2016-09-09 19:35 ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Alex @ 2016-09-09 19:24 UTC (permalink / raw)
  To: emacs-devel

I imagine that a lot of people nowadays who look at the list of built-in
c-styles in the manual would expect that the 'k&r' style would have a
c-basic-offset of 4, which is what is used in the 2nd edition of 'The C
Programming Language'.

For example, the k&r style mentioned in
https://en.wikipedia.org/wiki/Indent_style#K.26R_style has an offset of
4 spaces.

Would it make sense to add a k&r2 c-style that is an alias for the
'stroustrup' c-style to help alleviate any potential confusion?



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

* Re: Should there be a k&r2 c-style?
  2016-09-09 19:24 Should there be a k&r2 c-style? Alex
@ 2016-09-09 19:35 ` John Wiegley
  2016-09-09 20:08   ` Alex
  0 siblings, 1 reply; 8+ messages in thread
From: John Wiegley @ 2016-09-09 19:35 UTC (permalink / raw)
  To: Alex; +Cc: emacs-devel

>>>>> "A" == Alex  <agrambot@gmail.com> writes:

A> I imagine that a lot of people nowadays who look at the list of built-in
A> c-styles in the manual would expect that the 'k&r' style would have a
A> c-basic-offset of 4, which is what is used in the 2nd edition of 'The C
A> Programming Language'.

A> For example, the k&r style mentioned in
A> https://en.wikipedia.org/wiki/Indent_style#K.26R_style has an offset of
A> 4 spaces.

A> Would it make sense to add a k&r2 c-style that is an alias for the
A> 'stroustrup' c-style to help alleviate any potential confusion?

Is this just a supposition, or have you heard anyone actually say this?

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: Should there be a k&r2 c-style?
  2016-09-09 19:35 ` John Wiegley
@ 2016-09-09 20:08   ` Alex
  2016-09-09 20:54     ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Alex @ 2016-09-09 20:08 UTC (permalink / raw)
  To: emacs-devel

John Wiegley <jwiegley@gmail.com> writes:

>>>>>> "A" == Alex  <agrambot@gmail.com> writes:
>
> A> I imagine that a lot of people nowadays who look at the list of built-in
> A> c-styles in the manual would expect that the 'k&r' style would have a
> A> c-basic-offset of 4, which is what is used in the 2nd edition of 'The C
> A> Programming Language'.
>
> A> For example, the k&r style mentioned in
> A> https://en.wikipedia.org/wiki/Indent_style#K.26R_style has an offset of
> A> 4 spaces.
>
> A> Would it make sense to add a k&r2 c-style that is an alias for the
> A> 'stroustrup' c-style to help alleviate any potential confusion?
>
> Is this just a supposition, or have you heard anyone actually say this?
Just a supposition. I've never heard of anyone talk about it in the
context of Emacs, but I've noticed whenever the K&R style comes up it's
usually associated with a 4-space offset.

I myself did initially think that the k&r c-style would have a 4-space
offset before looking at 'c-style-alist'.

If an alias is too much, perhaps the manual could mention that the
'stroustrup' c-style provides what is used in the K&R2 book?



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

* Re: Should there be a k&r2 c-style?
  2016-09-09 20:08   ` Alex
@ 2016-09-09 20:54     ` John Wiegley
  2016-09-21 17:41       ` Alex
  0 siblings, 1 reply; 8+ messages in thread
From: John Wiegley @ 2016-09-09 20:54 UTC (permalink / raw)
  To: Alex; +Cc: emacs-devel

>>>>> "A" == Alex  <agrambot@gmail.com> writes:

A> If an alias is too much, perhaps the manual could mention that the
A> 'stroustrup' c-style provides what is used in the K&R2 book?

I think that would be probably be best.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: Should there be a k&r2 c-style?
  2016-09-09 20:54     ` John Wiegley
@ 2016-09-21 17:41       ` Alex
  2016-09-21 20:12         ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Alex @ 2016-09-21 17:41 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alan Mackenzie

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

John Wiegley <jwiegley@gmail.com> writes:

>>>>>> "A" == Alex  <agrambot@gmail.com> writes:
>
> A> If an alias is too much, perhaps the manual could mention that the
> A> 'stroustrup' c-style provides what is used in the K&R2 book?
>
> I think that would be probably be best.

Is something like this okay?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 506 bytes --]

diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index f311ec8..0628f8e 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -2554,7 +2554,9 @@ for C code in GNU programs.
 
 @item k&r
 @cindex K&R style
-The classic Kernighan and Ritchie style for C code.
+The classic Kernighan and Ritchie style for C code. If you're looking
+for the style used in the 2nd edition of their book ``The C
+Programming Language'', then check out the Stroustrup style.
 
 @item bsd
 @cindex BSD style

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

* Re: Should there be a k&r2 c-style?
  2016-09-21 17:41       ` Alex
@ 2016-09-21 20:12         ` John Wiegley
  2016-09-21 23:11           ` Alex
  0 siblings, 1 reply; 8+ messages in thread
From: John Wiegley @ 2016-09-21 20:12 UTC (permalink / raw)
  To: Alex; +Cc: Alan Mackenzie, emacs-devel

>>>>> "A" == Alex  <agrambot@gmail.com> writes:

A> Is something like this okay?

Yes, that looks good to me.  You may want to mention "stroustrup" in quotes
when naming the style, so that people know exactly what to look for.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

* Re: Should there be a k&r2 c-style?
  2016-09-21 20:12         ` John Wiegley
@ 2016-09-21 23:11           ` Alex
  2016-09-25 18:56             ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Alex @ 2016-09-21 23:11 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alan Mackenzie

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

John Wiegley <jwiegley@gmail.com> writes:

>>>>>> "A" == Alex  <agrambot@gmail.com> writes:
>
> A> Is something like this okay?
>
> Yes, that looks good to me.  You may want to mention "stroustrup" in quotes
> when naming the style, so that people know exactly what to look for.

That makes sense. I surrounded it in a @code block to match some other
mentions of styles.

If it's acceptable, would you commit it for me?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: style --]
[-- Type: text/x-diff, Size: 513 bytes --]

diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index f311ec8..6916169 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -2554,7 +2554,9 @@ for C code in GNU programs.
 
 @item k&r
 @cindex K&R style
-The classic Kernighan and Ritchie style for C code.
+The classic Kernighan and Ritchie style for C code. If you're looking
+for the style used in the 2nd edition of their book ``The C
+Programming Language'', then check out the @code{stroustrup} style.
 
 @item bsd
 @cindex BSD style

[-- Attachment #3: Type: text/plain, Size: 5 bytes --]


TIA

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

* Re: Should there be a k&r2 c-style?
  2016-09-21 23:11           ` Alex
@ 2016-09-25 18:56             ` John Wiegley
  0 siblings, 0 replies; 8+ messages in thread
From: John Wiegley @ 2016-09-25 18:56 UTC (permalink / raw)
  To: Alex; +Cc: Alan Mackenzie, emacs-devel

>>>>> "A" == Alex  <agrambot@gmail.com> writes:

A> If it's acceptable, would you commit it for me?

Yes, I'd be happy to.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



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

end of thread, other threads:[~2016-09-25 18:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-09 19:24 Should there be a k&r2 c-style? Alex
2016-09-09 19:35 ` John Wiegley
2016-09-09 20:08   ` Alex
2016-09-09 20:54     ` John Wiegley
2016-09-21 17:41       ` Alex
2016-09-21 20:12         ` John Wiegley
2016-09-21 23:11           ` Alex
2016-09-25 18:56             ` John Wiegley

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