Rewrite _lp_upwards_find for speed (#255)
fix promblematic shorten path function

The previous implementation had shell specific paths which did not
produce the same result. It did not respect the maximum length which it
calculated. And for specific cases even repeated part of the path.

This implementation is portable across bash and zsh.
It respects maximum length strictly and only exceeds it when it has to
respect LP_PATH_KEEP leading dirs.
It adds support for only showing the current directory, without leading
ones. This fixes Issue #219.

(Rebased by Olivier Mengué on top of more recent changes in that
fucntion)
Always show complete current dir when shortening path

When LP_PATH_KEEP=0 and current dirname were over maximum length the
name was also shorten. With this fixed _lp_shorten_path should now
always return at least the complete current dirname.
Check if root when striping trailing slash
Remove unneeded local keyword
shorten path: properly escape \ (bash) or % (zsh)
DIRTRIM: fix comment explaining how to enable the feature
Merge branch 'polyphemus/refactor-shorten_path' into develop

Improve _lp_shorten_path for less code and more reliability.
A great contibution by Rolf Morel.
Credit polyphemus
Refactor LP_PERM
Refactor VIRTUAL_ENV support for improved speed
VIRTUALENV: avoid usage of 'basename' (external command)
Do not load if $TERM is not valide (fixes #161)
Shorten path: fix escaping on both bash and zsh

Thanks to polyphemus (Rolf Morel) for the catch!
shorten_path: Escape '%' instead of using a var

When ${var//orig/replace} is intended with orig as '%' there is no need
to use a variable to avoid the '//%' form if the '%' is escaped.
Merge branch 'develop'

Merge changes from the develop branch:
- many fixes, in particular for MacOS X (battery)
- many speed improvments (Mercurial, Subversion)
- many reliability improvments (SHORTEN_PATH feature)
Ready for a release.