Changes between Version 41 and Version 42 of Commentary/CodingStyle


Ignore:
Timestamp:
Oct 27, 2011 8:19:51 AM (4 years ago)
Author:
batterseapower
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/CodingStyle

    v41 v42  
    217217 
    218218Please refer to [wiki:Commentary/PlatformNaming Platforms and Conventions] wiki page for an overview of how to handle target specific code in GHC. 
     219 
     220== Tabs vs Spaces == 
     221 
     222GHCs source code is indented with a mixture of tabs and spaces, and is standardised on a tabstop of 8. 
     223 
     224Most of the Haskell source code in GHC is free of tabs. We'd like to move away from tabs in the long term, and so a git hook on darcs.haskell.org will reject series of commits that add tabs to a file that is currently tab-free. (Note that there are no restrictions on adding tabs to a file already containing them.) 
     225 
     226In order to avoid angering this git hook, it is probably convenient to set your editor to indent using spaces rather than tabs: 
     227 
     228  * In Emacs, add `(setq-default indent-tabs-mode nil)` to your `.emacs` file ([http://cscs.umich.edu/~rlr/Misc/emacs_tabs.htm more discussion]) 
     229  * In Sublime Text, save the following to files at `Packages/User/Haskell.sublime-settings` and `Packages/User/Literate Haskell.sublime-settings`: 
     230 
     231{{{ 
     232{ 
     233        "tab_size": 8, 
     234        "translate_tabs_to_spaces": true 
     235} 
     236}}} 
     237 
     238  * In TextMate, open the Bundle Editor and add a new Preference called Indentation to the bundle editor. Give it the following contents: 
     239 
     240{{{ 
     241{       shellVariables = ( 
     242                {       name = 'TM_SOFT_TABS'; 
     243                        value = 'YES'; 
     244                }, 
     245        ); 
     246} 
     247}}}