[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1232989279-7452-1-git-send-email-tlikonen@iki.fi>
Date: Mon, 26 Jan 2009 19:01:19 +0200
From: Teemu Likonen <tlikonen@....fi>
To: Randy Dunlap <randy.dunlap@...cle.com>
Cc: linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Michael Kerrisk <mtk.manpages@...il.com>,
Johannes Weiner <hannes@...urebad.de>,
Dan Carpenter <error27@...il.com>
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@....fi>
---
Documentation/CodingStyle | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index 1875e50..7b5762e 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:
(* (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 the following in your .emacs file:
(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.
--
1.6.1.1.223.gc30e5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists