[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Electric indentation sub-optimality and resolution
From: |
Óscar Fuentes |
Subject: |
Re: Electric indentation sub-optimality and resolution |
Date: |
Fri, 19 Dec 2014 02:08:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
John Yates <address@hidden> writes:
> On Thu, Dec 18, 2014 at 3:07 PM, Dmitry Gutov <address@hidden> wrote:
>>
>> Personally, I like this lighter-weight approach:
>>
>> https://github.com/purcell/whitespace-cleanup-mode
>
>
> In my case I have show-trailing-whitespace set and my trailing-whitespace
> face is "red3". That made it very painful to insert blank lines in the
> presence of cc-mode's new electric indentation, even when some other
> mechanism / package / mode ultimately was going to clean things up
> (assuming I saved the file). Until I did a save my new electric whitespace
> messes were "in my face".
I had a similar setup here, but after using ws-butler it made no sense
anymore, since that package ensures that the file does not end with
newly added trailing whitespace.
> Steve Purcell's approach works only if one's file is pristine.
Yes, that disqualifies his package for me.
> Prior to
> the introduction of electric indentation I had no need of such a package: I
> was careful not to introduce inappropriate whitespace. But since I
> regularly have to work on files where other people have been less
> fastidious Steve's package would not clean these electric whitespace messes.
>
> I actually really like the behavior of the code I posted. It has an added
> small bonus. Normally it does not cleanup pre-existing whitespace. When I
> modify a line with trailing whitespace it does cleanup that one line,
> something my projects' guidelines allow.
That's what ws-butler does.
OTOH, your code is ok for adding it to the user's personal .emacs, but
not for incorporation into Emacs. The code should be made into a minor
mode or an optional feature of electric-indent-mode. Creating a new
minor mode makes more sense, IMO.
Anyways, we need to hear the opinion of the author of ws-butler package.
AFAIK he tried a similar approach to yours and found problems with it.