Ned Deily n...@acm.org writes:
As a side note, if you are prone to accidentally adding extra
whitespace (like I am), you can add the whitespace check hook into
your local copy of Mercurial so that you will be warned about
whitespace problems immediately when you commit things to your local
repos rather than later when you try to push them up to the python.org
repo.
Even earlier that the attempt to commit, one can configure the text
editor to show whitespace in order to be aware of it at the point where
it's easiest to change:
Emacs:
M-x whitespace-mode RET
Vim:
:set list listchars=trail:·,tab:»·
Or, instead of all whitespace, highlight trailing whitespace as an
error:
Emacs:
M-: (setq show-trailing-whitespace t) RET
Vim:
:set list listchars=trail:·,tab:»·
:highlight SpecialKey ctermfg=Yellow ctermbg=Red
Of course, any Python programmer hoping to comply with PEP 8 is best
advised to never insert a U+0009 HORIZONTAL TAB character:
Emacs:
M-: (setq indent-tabs-mode nil) RET
Vim:
:set expandtabs
One can even tell the editor to remove all the trailing whitespace:
Emacs:
M-x delete-trailing-whitespace RET
Vim:
:%s:\s\+$::
More:
URL:http://www.emacswiki.org/emacs/WhiteSpace
URL:http://stackoverflow.com/questions/3165503/emacs-global-configuration-of-tabs
URL:http://vim.wikia.com/wiki/Highlight_unwanted_spaces
URL:http://vim.wikia.com/wiki/Remove_unwanted_spaces
URL:http://stackoverflow.com/questions/69998/tabs-and-spaces-in-vim
This allows a belt-and-braces approach: the repository will reject
attempts to commit with whitespace mistakes, but one's text editor can
be an ally in never getting to that point.
--
\ “For fast acting relief, try slowing down.” —Jane Wagner, via |
`\ Lily Tomlin |
_o__) |
Ben Finney
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com