linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coding-style.rst: Add fallthrough as an emacs keyword
@ 2020-03-14 21:13 Joe Perches
  2020-03-15  2:12 ` Matthew Wilcox
  2020-03-20 23:31 ` Jonathan Corbet
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2020-03-14 21:13 UTC (permalink / raw)
  To: Jonathan Corbet, Federico Vaga, Harry Wei, Alex Shi
  Cc: linux-doc, linux-kernel

fallthrough was added as a pseudo-keyword by commit 294f69e662d1
("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use")

Add fallthrough as a keyword to the example .emacs content
so emacs can colorize or highlight the uses.

Signed-off-by: Joe Perches <joe@perches.com>
---

I've no idea how to remove the infinite monkeys jibe from the chinese translation

 Documentation/process/coding-style.rst                    | 9 +++++----
 Documentation/translations/it_IT/process/coding-style.rst | 9 +++++----
 Documentation/translations/zh_CN/process/coding-style.rst | 5 ++++-
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index acb2f1b..3260cd 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -577,9 +577,7 @@ item, explaining its use.
 That's OK, we all do.  You've probably been told by your long-time Unix
 user helper that ``GNU emacs`` automatically formats the C sources for
 you, and you've noticed that yes, it does do that, but the defaults it
-uses are less than desirable (in fact, they are worse than random
-typing - an infinite number of monkeys typing into GNU emacs would never
-make a good program).
+uses are less than desirable.
 
 So, you can either get rid of GNU emacs, or change it to use saner
 values.  To do the latter, you can stick the following in your .emacs file:
@@ -631,7 +629,10 @@ values.  To do the latter, you can stick the following in your .emacs file:
 
   (dir-locals-set-directory-class
    (expand-file-name "~/src/linux-trees")
-   'linux-kernel)
+   'linux-kernel
+   (font-lock-add-keywords 'c-mode
+			   '(("\\<\\(fallthrough\\)\\>" . font-lock-keyword-face)))
+  )
 
 This will make emacs go better with the kernel coding style for C
 files below ``~/src/linux-trees``.
diff --git a/Documentation/translations/it_IT/process/coding-style.rst b/Documentation/translations/it_IT/process/coding-style.rst
index 8725f2b..67364f 100644
--- a/Documentation/translations/it_IT/process/coding-style.rst
+++ b/Documentation/translations/it_IT/process/coding-style.rst
@@ -584,9 +584,7 @@ commento per spiegarne l'uso.
 Va bene, li facciamo tutti.  Probabilmente vi è stato detto dal vostro
 aiutante Unix di fiducia che ``GNU emacs`` formatta automaticamente il
 codice C per conto vostro, e avete notato che sì, in effetti lo fa, ma che
-i modi predefiniti non sono proprio allettanti (infatti, sono peggio che
-premere tasti a caso - un numero infinito di scimmie che scrivono in
-GNU emacs non faranno mai un buon programma).
+i modi predefiniti non sono proprio allettanti.
 
 Quindi, potete sbarazzarvi di GNU emacs, o riconfigurarlo con valori più
 sensati.  Per fare quest'ultima cosa, potete appiccicare il codice che
@@ -639,7 +637,10 @@ segue nel vostro file .emacs:
 
   (dir-locals-set-directory-class
    (expand-file-name "~/src/linux-trees")
-   'linux-kernel)
+   'linux-kernel
+   (font-lock-add-keywords 'c-mode
+			   '(("\\<\\(fallthrough\\)\\>" . font-lock-keyword-face)))
+  )
 
 Questo farà funzionare meglio emacs con lo stile del kernel per i file che
 si trovano nella cartella ``~/src/linux-trees``.
diff --git a/Documentation/translations/zh_CN/process/coding-style.rst b/Documentation/translations/zh_CN/process/coding-style.rst
index eae10bc..6c9443 100644
--- a/Documentation/translations/zh_CN/process/coding-style.rst
+++ b/Documentation/translations/zh_CN/process/coding-style.rst
@@ -558,7 +558,10 @@ Documentation/doc-guide/ 和 scripts/kernel-doc 以获得详细信息。
 
   (dir-locals-set-directory-class
    (expand-file-name "~/src/linux-trees")
-   'linux-kernel)
+   'linux-kernel
+   (font-lock-add-keywords 'c-mode
+			   '(("\\<\\(fallthrough\\)\\>" . font-lock-keyword-face)))
+  )
 
 这会让 emacs 在 ``~/src/linux-trees`` 下的 C 源文件获得更好的内核代码风格。
 



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

* Re: [PATCH] coding-style.rst: Add fallthrough as an emacs keyword
  2020-03-14 21:13 [PATCH] coding-style.rst: Add fallthrough as an emacs keyword Joe Perches
@ 2020-03-15  2:12 ` Matthew Wilcox
  2020-03-15  4:26   ` Joe Perches
  2020-03-20 23:31 ` Jonathan Corbet
  1 sibling, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2020-03-15  2:12 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jonathan Corbet, Federico Vaga, Harry Wei, Alex Shi, linux-doc,
	linux-kernel

On Sat, Mar 14, 2020 at 02:13:59PM -0700, Joe Perches wrote:
> I've no idea how to remove the infinite monkeys jibe from the chinese translation

I don't think you should.  That's part of Linus' original text, and I
don't think it deters contributors.

> -uses are less than desirable (in fact, they are worse than random
> -typing - an infinite number of monkeys typing into GNU emacs would never
> -make a good program).
> +uses are less than desirable.

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

* Re: [PATCH] coding-style.rst: Add fallthrough as an emacs keyword
  2020-03-15  2:12 ` Matthew Wilcox
@ 2020-03-15  4:26   ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2020-03-15  4:26 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Jonathan Corbet, Federico Vaga, Harry Wei, Alex Shi, linux-doc,
	linux-kernel

On Sat, 2020-03-14 at 19:12 -0700, Matthew Wilcox wrote:
> On Sat, Mar 14, 2020 at 02:13:59PM -0700, Joe Perches wrote:
> > I've no idea how to remove the infinite monkeys jibe from the chinese translation
> 
> I don't think you should.  That's part of Linus' original text, and I
> don't think it deters contributors.
> 
> > -uses are less than desirable (in fact, they are worse than random
> > -typing - an infinite number of monkeys typing into GNU emacs would never
> > -make a good program).
> > +uses are less than desirable.

It's silly, and moderately offensive,
unrepresentative of the softer, modern Linus.



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

* Re: [PATCH] coding-style.rst: Add fallthrough as an emacs keyword
  2020-03-14 21:13 [PATCH] coding-style.rst: Add fallthrough as an emacs keyword Joe Perches
  2020-03-15  2:12 ` Matthew Wilcox
@ 2020-03-20 23:31 ` Jonathan Corbet
  2020-03-20 23:45   ` Joe Perches
  1 sibling, 1 reply; 5+ messages in thread
From: Jonathan Corbet @ 2020-03-20 23:31 UTC (permalink / raw)
  To: Joe Perches; +Cc: Federico Vaga, Harry Wei, Alex Shi, linux-doc, linux-kernel

On Sat, 14 Mar 2020 14:13:59 -0700
Joe Perches <joe@perches.com> wrote:

> fallthrough was added as a pseudo-keyword by commit 294f69e662d1
> ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use")
> 
> Add fallthrough as a keyword to the example .emacs content
> so emacs can colorize or highlight the uses.
> 
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> 
> I've no idea how to remove the infinite monkeys jibe from the chinese translation

Removing the "jibe" is a second change for this patch, and one which is
not reflected in the changelog.  If we want to sanitize the docs that's
something we can talk about, but I don't want to sneak such changes in.

Please split the patch and make sure the appropriate people are copied on
that change.

Thanks,

jon

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

* Re: [PATCH] coding-style.rst: Add fallthrough as an emacs keyword
  2020-03-20 23:31 ` Jonathan Corbet
@ 2020-03-20 23:45   ` Joe Perches
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Perches @ 2020-03-20 23:45 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Federico Vaga, Harry Wei, Alex Shi, linux-doc, linux-kernel

On Fri, 2020-03-20 at 17:31 -0600, Jonathan Corbet wrote:
> On Sat, 14 Mar 2020 14:13:59 -0700
> Joe Perches <joe@perches.com> wrote:
> 
> > fallthrough was added as a pseudo-keyword by commit 294f69e662d1
> > ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use")
> > 
> > Add fallthrough as a keyword to the example .emacs content
> > so emacs can colorize or highlight the uses.
> > 
> > Signed-off-by: Joe Perches <joe@perches.com>
> > ---
> > 
> > I've no idea how to remove the infinite monkeys jibe from the chinese translation
> 
> Removing the "jibe" is a second change for this patch, and one which is
> not reflected in the changelog.  If we want to sanitize the docs that's
> something we can talk about, but I don't want to sneak such changes in.

And I don't want to bother with the naysayers.



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

end of thread, other threads:[~2020-03-20 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-14 21:13 [PATCH] coding-style.rst: Add fallthrough as an emacs keyword Joe Perches
2020-03-15  2:12 ` Matthew Wilcox
2020-03-15  4:26   ` Joe Perches
2020-03-20 23:31 ` Jonathan Corbet
2020-03-20 23:45   ` Joe Perches

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 NNTP newsgroup(s).