Line endings

Simon Marlow marlowsd at gmail.com
Fri May 13 13:17:59 CEST 2011


On 12/05/2011 14:52, Johan Tibell wrote:
> On Thu, May 12, 2011 at 2:12 PM, Max Bolingbroke
> <batterseapower at hotmail.com>  wrote:
>> If we outlawed them now we'd have to take an annoying one-time hit
>> removing all the (tons) of existing tabs, generating lots of merge
>> conflicts on all GHC branches for little immediate gain :-(
>>
>> So while I share your sentiment, I don't think eliminating tabs would
>> be worth it in cost/benefit terms.
>
> Perhaps we could just avoid adding new ones? I think you can make git
> check for new whitespace violations in a pre-commit hook. The problem
> I have with mixed spaces/tabs is when I cut-n-paste code (come on,
> we've all done that) you can have strange compilation errors due to
> copying code that was indented using tabs into code that was indented
> using spaces.

I don't like tabs either, but you shouldn't get strange compilation 
errors unless you have your editor set up to use the wrong tab width - 
remember, Haskell mandates 8-column tabs.  If you use anything else then 
you risk weird problems.

I have my emacs set up to replace tabs and delete end-of-line space on 
any line I edit.  If we wait long enough, all of GHC will be tab-free :) 
  I'd rather not do it all in one big sweep, I don't think it's causing 
enough grief to warrant the mess that would make of the history.

; Automatic whitespace trimming: ws-trim
(require 'ws-trim)
(global-ws-trim-mode t)
(setq
  ; trim only the lines I edit
  ws-trim-level 1
  ; trim trailing whitespace and convert tabs to spaces
  ws-trim-method-hook '(ws-trim-trailing ws-trim-tabs)
  ; don't do this in make-mode (don't want to turn tabs into spaces)
  ws-trim-global-modes '(guess (not makefile-mode makefile-gmake-mode))
)

Unfortunately this interacts badly with undo, to the extent that Simon 
turned it off.  I put up with the undo problems to get whitespace sanity.

Cheers,
	Simon



More information about the Cvs-ghc mailing list