[RFC] whitespace.el

Didier Verna didier at xemacs.org
Fri Apr 27 11:55:09 EDT 2007


skip at pobox.com wrote:

> Just an FYI (haven't posted this to python-dev yet), my problems with
> dangling whitespace are caused by hitting RET or LF
> (py-newline-and-indent) which indents according to the current
> environment, then moving away from that indentation using a command
> python-mode doesn't know about (e.g. previous-line), so it doesn't
> have the opportunity to delete the whitespace. The whitespace module
> might help here, though I've never used it. I think the best place for
> it would be as a write-file-hook

That's the way I use it. There's a machinery to do exactly that in it
already.


> though I worry about it not being aware of Python's triple-quoted
> strings which can extend over multiple lines and which might
> presumably contain legitimate trailing whitespace.

Gosh:-/ My current changes are: 1/ being able to activate whitespace
cleanup on a per file basis, as well as on a per-mode basis (which is
the only possibility in the current version), and 2/ being able to
select exactly which ones of the 5 kinds of cleanup you want to activate
according to the file / mode you're editing.

Activating trailing whitespace cleanup differently at different places
in the same file/buffer is not going to be trivial. Actually, I don't
think that's whitespace's job anyway.

This sounds to me like a job for mmm-mode. You would have a special
major-mode for editing your triple-quoted strings, and trigger
whitespace cleanup differently according to this, and the other major
modes in your buffer.


-- 
Read the Jazz Blog !! http://jazzblog.didierverna.com

Didier Verna, didier at lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bicêtre, France   Fax.+33 (1) 53 14 59 22   didier at xemacs.org



More information about the XEmacs-Beta mailing list