Add support for history --merge to incorporate history changes from
other sessions.

Fixes #825
Clean up default environment variables.

This stops unconditionally setting values for HOME and USER,
if we find those values in the environment. It also saves about 16KB
on OS X, which getpwuid allocates.