What to do About Tabs?
|
||
Working groups |
Blessed plots and figures |
Approving new results and publications |
Approval web pages - new results |
Approval web pages - new publications |
Mu2e Acronyn Dictionary |
Fermilab Meeting Rooms |
Fermilab Service Desk |
ReadyTalk : Home |
ReadyTalk : Help |
ReadyTalk : Toll Free Numbers |
Please configure your editor(s) so that they do not write tab characters to source code files. Please do configure your editor so that, when you hit the tab key, it inserts the appropriate number of spaces to achieve the desired formatting.
The reason for this request is that different editors, or different configurations of the same editor, render tab characters differently. To be clear we are discussing what the editor does when it encounters a tab character in the text of the file; we are not (yet) discussing what the editor does when you hit the tab key.
Most editors can be configured to interpret a tab character in the file text to mean "move the cursor to the right to the next tab stop", where tab stops might be defined differently from one editor to another or even among various configurations for the same editor. Different printers also have different interpretations of where the tab stops are. If we are not careful about the usage of tabs, then code that displays in a nicely lined up format in my editor may not display nicely in your editor and may not print nicely on some printers; similarly, code that lines up nicely in your editor may not line up nicely in my editor.
What happens when you press the tab key? Most editors can be configured that hitting the tab either inserts a tab character into the text or it inserts an appropriate number of spaces. When editing C++ source code, most editors are aware of the structure of the language and have the ability to do context sensitive indentation. If the line is already properly indented, the editor will do nothing.
This does not address the issue of indentation policy, how many spaces to indent the body of an if block, and so on. I think we can let authors decide on the details of their own policy, 2 spaces, 4 spaces, whatever. But please do choose such a policy and implement your policy in a way that does not put tab characters in the files.
As I learn how to do so, I will add the information for other editors.
If you are using emacs , add the followieng line to the end of your .emacs file
(setq-default indent-tabs-mode nil)If you are using xemacs, add the same line to your ~/.xemacs/init.el file.
You can also do this from command mode:
If you are using vim,
Security, Privacy, Legal |