Half-width indentation for "where" keyword

iquiw iku.iwasa at gmail.com
Wed Jun 2 23:59:51 EDT 2010


Hi,

I wrote a patch attached to make offsets around `where' configurable.

It introduces 2 new variables, haskell-indentation-where-pre-offset and
haskell-indentation-where-post-offset. Both are set to 2 as default.

They act as follows;
-----------------------------------------------
myFun = do
<w>print "hi"
<w>print name
<w1>where
<w1><w2>name = "Mini Me"
-----------------------------------------------
where
 w1 = haskell-indentation-where-pre-offset
 w2 = haskell-indentation-where-post-offset


Could you confirm the patch and apply it to the main repo if it is OK?

Thanks in advance,
iquiw

# Attached the patch again since my previous mail was not delivered to
the list due to haskell.org down...

On Thu, Jun 3, 2010 at 4:39 AM, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Tue, Jun 1, 2010 at 11:59 AM, iquiw <iku.iwasa at gmail.com> wrote:
>>
>> Seems haskell mailing lists are not working now...
>>
>> I made the `amend-record' version of the previous patch,
>> which, I think, fixes the nested-where problem.
>
> Works great. Saves me lots of frustration when editing Haskell code. What
> are the chances to get the patch into the main repo? I think the style that
> it support is common in practice; it's used in Real World Haskell for
> example.
>
>>
>> There is one known issue I have not figured out why.
>> It needs 4 tab key presses to change (a) to (b)
>> (a)
>> --------------------------
>> foo = do
>>    bar
>>    where
>> --------------------------
>> (b)
>> --------------------------
>> foo = do
>>   bar
>>  where
>> --------------------------
>
> I think it has to do with having to press tab one extra time to cycle back
> to the beginning of the set of possible indentations. I think this is normal
> Emacs behavior.
>
>>
>> OT: I have never used nested-where, what is the benefit?
>
> They're occasionally useful in nested function definitions.
> Johan
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: where-offset-2.dpatch
Type: application/octet-stream
Size: 4323 bytes
Desc: not available
Url : http://projects.haskell.org/pipermail/haskellmode-emacs/attachments/20100603/62361f69/attachment.obj 


More information about the Haskellmode-emacs mailing list