[Dune] [#2] Common code-formatting
Dune
dune at dune-project.org
Tue Sep 29 15:28:03 CEST 2009
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#2 - Common code-formatting
User who did this - Jö Fahlke (joe)
----------
I believe there are two import issues regarding indentation we should agree upon:
1. The use of tabs for indentation,
2. how many character positions one indentation level should *usually* indent.
Once these two issues a decided, we can write mode-lines for emacs and vim into all files, although I doubt that can be done automatically. (You have to look at each file and find the tab-width currently to put it in the mode-line or to replace the tabs by spaces. Some files may not even use a consistent tab-width.)
I propose to ban tabs for indentation, and to enforce that via mode-lines for emacs and vim. For files which currently do indentation using tabs, I propose record the tab-width in the mode-lines so that the editors will display them correctly, but not to replace the tabs with spaces, as long as the tab-width within that file is consistent.
I propose two character positions as the usual indentation width, but to allow exceptions where that improves the readability.
My reason for banning tabs is that there is no good reason to use them (disk space is cheap), and that there seems to be very little consensus as to how far apart to place the tab stops. It is very likely that two persons with different tab widths editing the same file will produce utter chaos. On the other hand I don't want to produce unnecessarily large diffs to keep forward and backward porting easy. So if we can get away with recording the tab-width in the mode-line for emacs and vim, we should not replace every tab by spaces.
The reasons for the indent width of two are 1) that seem to be most common in dune, and 2) I have grown to like it. There are many cases such as function and template parameter lists where a different indentation level produces better readability, so this should be a guideline rather then a strict rule.
There are many other indentation issues such as the placement of opening braces, whether to enforce line-breaks before the statement in a single-clause if-statement etc., but I think they are a all of marginal importance.
Are there any users of editors besides Emacs and Vim out there? Is it possible the tell your editor whether to use tabs for indentation, the indent width and the tab width via some magical comment in the file or a special file somewhere in the directory?
----------
More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=2#comment1109
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
More information about the Dune
mailing list