Difference between revisions of "Preparing a Patch for Review"
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
<h2>Best Practices</h2> | <h2>Best Practices</h2> | ||
| − | * 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. | + | * 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); | ||
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);