mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/3 for mainline, v2] Documentation: update CodingStyle tips for Emacs users
@ 2009-01-26 21:03 Randy Dunlap
  0 siblings, 0 replies; only message in thread
From: Randy Dunlap @ 2009-01-26 21:03 UTC (permalink / raw)
  To: lkml; +Cc: Teemu Likonen

From: Teemu Likonen <tlikonen@iki.fi>
Subject: [PATCH v2] Documentation: update CodingStyle tips for Emacs users

With the previous Emacs tips example the kernel style was made available
for files in the kernel-tree only. This patch updates the tip to add a
separate cc-mode indent style ("linux-tabs-only"). This makes it easy to
switch between different indent styles and also makes the kernel style
easily available for any filetype mode (c++, awk, ...) that is managed
by the Emacs cc-mode.

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 Documentation/CodingStyle |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

--- linux-next-20090126.orig/Documentation/CodingStyle
+++ linux-next-20090126/Documentation/CodingStyle
@@ -483,6 +483,16 @@ values.  To do the latter, you can stick
     (* (max steps 1)
        c-basic-offset)))
 
+(add-hook 'c-mode-common-hook
+          (lambda ()
+            ;; Add kernel style
+            (c-add-style
+             "linux-tabs-only"
+             '("linux" (c-offsets-alist
+                        (arglist-cont-nonempty
+                         c-lineup-gcc-asm-reg
+                         c-lineup-arglist-tabs-only))))))
+
 (add-hook 'c-mode-hook
           (lambda ()
             (let ((filename (buffer-file-name)))
@@ -490,10 +500,7 @@ values.  To do the latter, you can stick
               (when (and filename
                          (string-match "~/src/linux-trees" filename))
                 (setq indent-tabs-mode t)
-                (c-set-style "linux")
-                (c-set-offset 'arglist-cont-nonempty
-                              '(c-lineup-gcc-asm-reg
-                                c-lineup-arglist-tabs-only))))))
+                (c-set-style "linux-tabs-only")))))
 
 This will make emacs go better with the kernel coding style for C
 files below ~/src/linux-trees.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-26 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-26 21:03 [PATCH 2/3 for mainline, v2] Documentation: update CodingStyle tips for Emacs users Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome