aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/CodingStyle
diff options
context:
space:
mode:
authorTeemu Likonen <tlikonen@iki.fi>2009-01-29 19:28:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-29 21:19:29 -0500
commit0acbc6c651911dc9ffb4f59b34306bc1ccb751e5 (patch)
treed6af14717c31b850df821aae2a9ee7a884709ee6 /Documentation/CodingStyle
parent5872fb94f85d2e4fdef94657bd14e1a492df9825 (diff)
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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/CodingStyle')
-rw-r--r--Documentation/CodingStyle15
1 files changed, 11 insertions, 4 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 1875e502f872..7b5762eded2c 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -483,6 +483,16 @@ values. To do the latter, you can stick the following in your .emacs file:
483 (* (max steps 1) 483 (* (max steps 1)
484 c-basic-offset))) 484 c-basic-offset)))
485 485
486(add-hook 'c-mode-common-hook
487 (lambda ()
488 ;; Add kernel style
489 (c-add-style
490 "linux-tabs-only"
491 '("linux" (c-offsets-alist
492 (arglist-cont-nonempty
493 c-lineup-gcc-asm-reg
494 c-lineup-arglist-tabs-only))))))
495
486(add-hook 'c-mode-hook 496(add-hook 'c-mode-hook
487 (lambda () 497 (lambda ()
488 (let ((filename (buffer-file-name))) 498 (let ((filename (buffer-file-name)))
@@ -490,10 +500,7 @@ values. To do the latter, you can stick the following in your .emacs file:
490 (when (and filename 500 (when (and filename
491 (string-match "~/src/linux-trees" filename)) 501 (string-match "~/src/linux-trees" filename))
492 (setq indent-tabs-mode t) 502 (setq indent-tabs-mode t)
493 (c-set-style "linux") 503 (c-set-style "linux-tabs-only")))))
494 (c-set-offset 'arglist-cont-nonempty
495 '(c-lineup-gcc-asm-reg
496 c-lineup-arglist-tabs-only))))))
497 504
498This will make emacs go better with the kernel coding style for C 505This will make emacs go better with the kernel coding style for C
499files below ~/src/linux-trees. 506files below ~/src/linux-trees.