From: gmate.amit@gmail.com (Kumar amit mehta)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Query on CodingStyle: indentation
Date: Sun, 21 Oct 2012 21:36:13 -0700 [thread overview]
Message-ID: <20121022043612.GA2758@gmail.com> (raw)
In-Reply-To: <CAGpXXZ+i=ABQVNHkwSgFX02-aArCv=_6MK2sw61e1HrVRasbag@mail.gmail.com>
On Fri, Oct 19, 2012 at 11:40:35AM -0400, Greg Freemyer wrote:
> On Fri, Oct 19, 2012 at 5:00 AM, Kumar amit mehta <gmate.amit@gmail.com> wrote:
> > On Fri, Oct 19, 2012 at 03:03:28PM +0800, Adam Lee wrote:
> >> On Thu, Oct 18, 2012 at 10:31:29PM -0700, Kumar amit mehta wrote:
> >> > Hi,
> >> >
> >> > I've a query regarding the coding style for Linux Kernel code. I'm
> >> > reading the CodingStyle under Documentation and what I've understood is
> >> > that I shouldn't be using spaces for indentation purposes and should use
> >> > tabs of width 8 characters. Quoting from the same document:
> >> > "Outside of comments, documentation and except in Kconfig, spaces are
> >> > never used for indentation, and the above example is deliberately broken."
> >> > However, Is it correct to replace each tab stroke by 8 spaces ? I use vim
> >> > editor and I've put following under $HOME/.vimrc file:
> >> > <snip>
> >> > set tabstop=8
> >> > set shiftwidth=8
> >> > set expandtab
> >> > <snip>
> >> >
> >> > In past I've seen that some application have different interpretation of
> >> > tabs and hence sometimes even If I've done proper indentation using tab,
> >> > the code appears unindented, and therefore In order to make sure that I'm
> >> > moving 8 characters upon hitting tab, I've put the above rules under my
> >> > .vimrc file. Please let me know If I should remove these from my .vimrc
> >> > file and rely on tab instead.
> >>
> >> No, you should not expand tabs. Tabs in CodingStyle mean _hard_ tabs.
> >>
> >> Mine:
> >>
> >> <snip>
> >> set tabstop=8
> >> set noexpandtab
> >> set shiftwidth=8
> >> set cinoptions=:0,l1,t0,g0
> >> <snip>
> >>
> >
> > Thank you Adam for sharing your vim recipe.
>
> I believe you can still use your standard vim recipe, then run
> checkpatch.pl on your patches to replace spaces with tabs before
> sending them to upstream.
>
> Someone else who uses that workflow would need to confirm that works well.
>
> Greg
Thank you Greg for reminding about this script(checkpatch.pl). I updated
my $HOME/.vimrc file as per Adam's suggestion and generated a patch and
then ran this checkpatch.pl script against my patch and It didn't give
me any error. So I guess the above vim recipe is fine. I've sent that
patch to kernel-janitor group and had kept the maintainer in the CC as
well. I haven't got the reply yet, so I don't know if my patch got
merged or not.
-Amit
prev parent reply other threads:[~2012-10-22 4:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 5:31 Query on CodingStyle: indentation Kumar amit mehta
2012-10-19 7:03 ` Adam Lee
2012-10-19 9:00 ` Kumar amit mehta
2012-10-19 15:40 ` Greg Freemyer
2012-10-22 4:36 ` Kumar amit mehta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121022043612.GA2758@gmail.com \
--to=gmate.amit@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).