Do not insert equal sign if one already
Deniz Dogan
deniz.a.m.dogan at gmail.com
Fri Nov 5 04:08:41 EDT 2010
2010/11/4 Johan Andersson <johan.rejeep at gmail.com>:
> Well, I used this command mostly to get the equal signs aligned. When you
> change a functions arguments, the equal signs will not be aligned anymore.
> Then it great to be able to just quickly align them and in that case you
> don't want to insert an equal sign.
Sorry, I had misunderstood the intent of the command.
> Maybe the function could be split up into two? One that only aligns and one
> that aligns and insert the equal sign.
I'm not sure there is any point in splitting it up into two functions
as you described as the body of one of them would essentially be only
(insert "="). And haskell-indent-align-def already does the other
part.
> On Thu, Nov 4, 2010 at 12:19 AM, Deniz Dogan <deniz.a.m.dogan at gmail.com>
> wrote:
>>
>> 2010/11/2 Johan Andersson <johan.rejeep at gmail.com>:
>> > Or maybe this is better so you can be anywhere in a line without
>> > inserting
>> > the equal sign:
>> > (unless (string-match "=" (buffer-substring-no-properties
>> > (line-beginning-position) (line-end-position)))
>> > (insert "= "))
>>
>> Consider this example:
>>
>> foo a | a == 1 = 2
>> | a == 2 *
>>
>> Note that the second line needs indentation and you want to both
>> indent the line and insert "=". With your latest suggestion, it would
>> not insert the character.
>>
>> I think your first idea with looking-back is the better way to go,
>> even though I wonder why you use this command if you already have an
>> equals sign.
>>
>> --
>> Deniz Dogan
>
>
More information about the Haskellmode-emacs
mailing list