Difference between revisions of "Preparing a Patch for Review"
Line 3: | Line 3: | ||
* Avoid saving tab characters in the patch. The main reason is that different text editors use different defaults to interpret tab characters as spaces. Also some people like to set 8 spaces as the default for a tab character while others prefer 4 or 3. The end result is that the proposed code will look unformatted, making hard to the eye to read and follow the code indentations. Possible ways to teach your text editor: | * Avoid saving tab characters in the patch. The main reason is that different text editors use different defaults to interpret tab characters as spaces. Also some people like to set 8 spaces as the default for a tab character while others prefer 4 or 3. The end result is that the proposed code will look unformatted, making hard to the eye to read and follow the code indentations. Possible ways to teach your text editor: | ||
− | For vi family set the following in your .exrc: | + | For vi family set the following in your .exrc: |
− | + | set expandtab | |
− | For emacs family add the following to your .emacs: | + | For emacs family add the following to your .emacs: |
− | + | (setq-default indent-tabs-mode nil); |
Latest revision as of 21:23, 30 August 2012
Best Practices
- Avoid saving tab characters in the patch. The main reason is that different text editors use different defaults to interpret tab characters as spaces. Also some people like to set 8 spaces as the default for a tab character while others prefer 4 or 3. The end result is that the proposed code will look unformatted, making hard to the eye to read and follow the code indentations. Possible ways to teach your text editor:
For vi family set the following in your .exrc: set expandtab
For emacs family add the following to your .emacs: (setq-default indent-tabs-mode nil);