Comment 2 for bug 1100892

Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 1100892] [NEW] py-newline-and-indent leaves eol whitespace cruft

On Jan 17, 2013, at 07:36 PM, Andreas Roehler wrote:

>Am 17.01.2013 19:07, schrieb Barry Warsaw:
>> Public bug reported:
>>
>> py-newline-and-indent leaves extra whitespace at eol if used inside an
>> existing construct. It should instead clean up all trailing whitespace.
>> I believe this is a regression.
>
>Auto-delete trailing whitespace was cancelled when fixing lp:1020220
>
>Customizing then introduced py-trailing-whitespace-smart-delete-p to `t'
>should do it. Maybe change the default?

A few comments:

For py-newline-and-indent, I think it is not correct that python-mode delete
all trailing whitespace in the buffer. It should only delete the trailing
whitespace on the line you are editing (specifically: the line on which you
hit RET).

I'm also not sure that the same variable which controls trailing whitespace
cleanup for RET should also control buffer-wide whitespace cleanup on save.
As the docstring for py-t-w-s-d-p says, this can have negative consequences
for editing other people's code.

For example: I always want to clean up the line I'm editing, but I do *not*
want to clean up the entire buffer, since that will introduce lots of cruft
into diffs. If I do want to clean up the entire buffer, I have a separate
function I can call explicitly (or I could put it on a save hook myself).

As for the default, if the save hook side-effect didn't exist, then yes, it
should be t by default.